Errors with OpenRecordset

  • Thread starter Thread starter J Labar
  • Start date Start date
J

J Labar

In Access 2002, I am trying to open a linked table
called 'tblContacts' and write a new record to the table
from a form after I have run some validation routines. I
keep getting an 'Invalid Arguement' arguement error when
the code gets to the Set line as below. When I mouse over
the dbOpenDynaset constant, it says dbOpenDynaset = Empty.

Do I have to add a Reference or something?

Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("tblContacts",
dbOpenDynaset)

Thanks,
Jeff
 
Hi,
What happens if you declare rst like this:
Dim rst As DAO.Recordset ?
Although the error should have been Type Mismatch.
 
Now the execution is stopping at the Dim statement with a
Compile Error: User-defined type not defined.

Sounds like I'm missing something?
 
Hi,
Okay, you need to set a reference to the DAO library.
With any code module open, go to:
Toos->References
and then select the Microsoft DAO.xxx library
where xxx is the version on your machine.
 
That did it, thanks.
-----Original Message-----
Hi,
Okay, you need to set a reference to the DAO library.
With any code module open, go to:
Toos->References
and then select the Microsoft DAO.xxx library
where xxx is the version on your machine.

--
HTH
Dan Artuso, Access MVP





.
 
Back
Top