Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO Insert help

Status
Not open for further replies.

121854

MIS
Aug 2, 2003
60
US
Can anyone help me develop an ADO insert record set to update an access database?

I'm availbe to establish the ADO connection but I don't know who to define the recordset and the update commands to update an access database.

The access database has the following attributes:
ssn
transaction_type
transaction_amount
transaction_notes

I want to insert a new record with information on all the above fields.

Any example will be helpfull.

Help will be appreciated.
 
You may be able to use the DoCmd.RunSql command. I'm still puzzled by the syntax, but many things puzzle me.

'Define the values into variables
'Define the SQL string

strSQL = "INSERT INTO tableName([ssn],[transaction_type],[transaction_amount],[transaction_notes] VALUES (""" & strSSN & """,""" & strTransType & """,""" & strTransAmt & """)"

' Run the command

DoCmd.RunSQL strSQL
 
This is actually an interesting question. As capmark says, you don't really need a recordset if you are going to do an insert; you can just use SQL.

However if you did want to use a recordset and do a recordset.AddNew, can you declare an empty recordset? You don't want to retrieve any records if you are simply going to add one but you need to declare a recordset object, so what could you put in the recordset open statement?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top