View Full Version : Type Mismatch when Set myRS


dmmckelv
01-04-2009, 11:54 AM
Can anyone help me understand why this code:

Dim ingredientTableRS As Recordset
Set ingredientTableRS = CurrentDb.OpenRecordset("ingredientTable")would give me a "Type Mismatch" error. I am using Microsoft Access version 2002 (I think this may be my problem, I am not used to it.)

Thanks for your help!

dmmckelv
01-04-2009, 11:56 AM
Also if I set type to dbOpenDynaset or dbOpenTable, I get an "Invalid Argument" error.

thanks.

dmmckelv
01-04-2009, 12:00 PM
One more thing. When I try Dim db As Database I get "Compile Error: User Defined-Type Not Defined"

boblarson
01-04-2009, 12:19 PM
For 2002 ADO was the default. You need to

1. Set a reference to Microsoft DAO 3.x
To get there go to the VBA Window and go to TOOLS > REFERENCES and scroll down until you find it where x is either .51 or .6

2. Then use

Dim db as DAO.Database

and

Dim ingredientTableRS As DAO.Recordset