
Inserting Records Into an Access DB
I went to that site (btw, very informative) but I get an error when I run my
program. I have a button on the form called cmdAddData. Under the
cmdAddData_Click() procedure I have the following:
Private Sub cmdAddData_Click()
Dim db As Database
Dim rs As Recordset
Set db = OpenDatabase("D:\test.mdb")
Set rs = db.OpenRecordset("Customer", dbOpenTable)
rs.AddNew
rs.Fields("cust_id") = txtCust_ID.Text
rs.Close
Set rs = Nothing
End Sub
When I fill out the form and click on the cmdAddData button, I get a
run-time error (3343) on the Set db line saying "Unrecognized database
format 'D:\test.mdb'." I created the database with Access2000 and made
sure that the database is there. Any suggestions?
Quote:
> > Can anyone recommend a good site that explains how to
> > interact with an Access DB using ADO? I'm able to pull
> > info out of the database, but I can't figure out how to
> > insert a new record. Thanks!
> Try http://www.geocities.com/~chuckeasttom/vb/Vb.htm
> Then go to database programming 101.