Database variant type

R

Roy Seifert

In Access 97 I could open and manipulate a table directly
with the following code:

Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("region", dbOpenDynaset)

When I try the same code in Access 2000 I get an error
message about Database being an undefined user type!
Access '97 databases converted to Access 2000 have the
Database variant type. A new Access 2000 database does
not have the Database variant type. Using Access 2000,
how do I open a table so I can manipulate the records
directly through code?

Thanks
 
C

Cheryl Fischer

The type of error you report is usually caused by the lack of a reference to
the Microsoft DAO 3.6 Object Library. Just open any code window by
pressing ALT-F11, then select Tools|References. Scroll through the list of
available references and select the one mentioned above by placing a check
mark in the box. Click OK.

Then, in your code you should dimension the objects explicitly as DAO:

Dim db as DAO.Database
Dim rs as DAO.Recordset

The rest of your code should work fine.
 
R

Roy Seifert

Thanks, Cheryl. It worked!
-----Original Message-----
The type of error you report is usually caused by the lack of a reference to
the Microsoft DAO 3.6 Object Library. Just open any code window by
pressing ALT-F11, then select Tools|References. Scroll through the list of
available references and select the one mentioned above by placing a check
mark in the box. Click OK.

Then, in your code you should dimension the objects explicitly as DAO:

Dim db as DAO.Database
Dim rs as DAO.Recordset

The rest of your code should work fine.


--
Cheryl Fischer
Law/Sys Associates
Houston, TX




.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top