2012-11-13 82 views
0

使用文本框,組合框包含信息。我想從電源點將數據導出到aceess數據庫。我想像表單一樣使用powerpoint來完成數據庫。將數據從電源點導出到數據庫

解決方法是有一個按鈕來更新這個數據庫。 任何人都有該按鈕的代碼?

回答

0

下面是關於一種方法的一些粗略註釋。還有其他一些可能性。

''Library reference: Microsoft ActiveX data Objects x.x Lubrary 

Dim cmd As ADODB.Command 
Dim cn As ADODB.Connection 
Dim scn As String, ssql As String 

''See also http://ConnectionStrings.com 
scn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Z:\Docs\Test.accdb;" 
Set cmd = CreateObject("ADODB.Command") 
Set cn = CreateObject("ADODB.Connection") 

cn.Open scn 
ssql = "insert into table1 (atext,amemo) values(p1,p2)" 
With cmd 
    .CommandText = ssql 
    .ActiveConnection = cn 
    .CommandType = adCmdText 
    .Parameters.Append .CreateParameter(_ 
     "p1", adVarChar, adParamInput, 50, Me.ComboBox1) 
    .Parameters.Append .CreateParameter(_ 
     "p2", adVarChar, adParamInput, 50, Me.TextBox1) 
    .Execute recs 
End With 

MsgBox recs 
相關問題