Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access VBA Changes from 97 to 2002 (DIM DB AS DATABASE)

Status
Not open for further replies.

rstitzel

MIS
Apr 24, 2002
286
US
I just recently upgraded from Access 97 to Access 2002. I have code in my old databases that I'm trying to use in Access 2002.

The line that is creating a problem is:

Dim db as database

When I compile the module I get the Compile Error User Defined Type Not Defined.

Why is this? I use this quite a bit.

Appreciate any help
 
You really don't need that line, you can just use CurrentDB, for example:

Dim db as Database
Dim rs as Recordset

Set db = CurrentDB
Set rs = db.OpenRecordset(..., ...)

Now Becomes:

Dim rs as DAO.Recordset
Set rs = CurrentDB.OpenRecordset(..., ...)

This of course is if you continue to use DAO rather than ADO which is totally different syntax. Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top