Add Record Button on Form

LWCARAB

Registered User.
Local time
Today, 22:58
Joined
Jan 29, 2008
Messages
38
Hello,

I am trying to put in and add button to my form so it saves everything into the table, here is my code:

Private Sub Add_Click()
Dim db As Database
Dim rsWrk As Recordset
Set db = DBEngine(0)(0)
Set rsWrk = db.OpenRecordset("Table", DB_OPEN_DYNASET)
rsWrk.AddNew
rsWrk![Title] = Me![Title]
rsWrk![Length] = Me![Length]
rsWrk![Journal] = Me![Journal]
rsWrk![page_no] = Me![Page]
rsWrk![additional] = Me![Other]
rsWrk![language] = Me![language]
rsWrk![rating] = Me![InterestLevel]
rsWrk![subject] = Me![subject]
rsWrk![SecondarySource] = Me![SecondarySource]
rsWrk![accession] = Me![AccessionCode]
rsWrk![Environment] = Me![Environment]
rsWrk![generalmarket] = Me![GeneralMarketInformation]
rsWrk![Company] = Me![Company]
End Sub


But I get an error for line 5, the error is:

Runtime Error 13, Type mismatch



Thanks for your help,

Richard
 
Try:
Dim db As DAO.Database
Dim rsWrk As DAO.Recordset
 
Thanks for your reply.
That has got rid of the error but now nothing happens, the data doesn't go to the table nor do any messages appear.

Richard
 

Users who are viewing this thread

Back
Top Bottom