Type mismatch error in Access 2003

  • Thread starter Thread starter TheCatWho
  • Start date Start date
T

TheCatWho

Guest
I am trying to create an audit trail in a table using an example from http://www.rogersaccesslibrary.com/. I am getting a type mismatch error at the indicated line. I think I have the right references and the syntax looks right to me, but obviously I'm missing something.

Sub WriteAuditUpdate(txtTableName, txtFieldName, OrgValue, CurValue)

Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
--> Set rs = db.OpenRecordset("Audit")

It's been five years since I used VB, and I am new to Access (and this forum, so I hope I haven't transgressed any customs). I did a search here but nothing seemed to apply to my question. Any ideas?

Thank you.
 
Go into Tools/References and check the Microsoft DAO 3.6 Object Library. Then change these 2 lines

Dim db As Database
Dim rs As Recordset

to

Dim db As DAO.Database
Dim rs As DAO.Recordset

Then give it a whirl.
 
THANK YOU!

Jeez, I've been whacking my head against this one for more than a day. Now it works.

Hooray!
 

Users who are viewing this thread

Back
Top Bottom