[AccessD] ADO insert command

Doug Steele dbsteele at dccnet.com
Tue Feb 16 18:46:28 CST 2010


Hello All:

I have some code which connects to a MySQL database.  Simply Accounting, in
this case - they have changed their back end to MySQL from Access.

Now I want to run an insert query to grab some data from Simply.  Here's my
code:

Public Sub ImportSimplyTables(conn As ADODB.Connection)
  Dim rs As ADODB.Recordset
  Dim Cmd As String

  Cmd = "INSERT INTO taccountx ( lId, dYtc ) SELECT tAccount.lId,
tAccount.dYtc FROM tAccount;"
  conn.Execute Cmd, , adCmdText + adExecuteNoRecords

End Sub

I've tried various combinations of adCmdText, adExecuteNoRecords, etc. but
nothing seems to work.  The Execute runs but no records are added to my
table taccountx.  I know that the connection is opened correctly; if I
create an ADO recordset from the tAccount table I can read it and the fields
are present and have data.

Any suggestions?  Thanks,

Doug



More information about the AccessD mailing list