简体   繁体   中英

export data from power point to access database

In have a powerpoint with Text Box, Combo box with informations.I want to export data from power point to an aceess database. I want to use the powerpoint like an form to complete the database.

Solution is to have an button to update this database. Anyone has the code for this button?

Here are some rough notes on one approach. There are a number of other possibilities.

''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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM