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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Missing DAOs

Status
Not open for further replies.

bujin

MIS
Oct 2, 2000
144
GB
I'm trying to write code for my database to control the database and recordsets in Access, but when I try to use the line:

Dim dbs as Database

Access doesn't recognise the word "Database". The list that appears as you enter a datatype doesn't mention Database, DAO, tabledef or anything like that (although it does contain Recordset). If I write in "database", Access does not recognise it - when I run the code, it gives me an error message saying "Compile Error: User Defined Type not defined".

HOWEVER. If I run one of my older databases that I wrote before we got upgraded to XP which made extensive use of DAOs, it works fine!

So something is missing somewhere. Could it be some sort of access permissions or something like that? The IT dept says that the whole package was installed.

BTW, I'm currently using Access XP, but my old databases were written in Access 97.
 
I don't have XP, but when I moved up to 2000, I had to declare my variable like this

Dim db as DAO.Database
Dim rst as DAO.Recordset

You might try that and see if it helps.

Paul
 
I might add that when you open a new database in A2000, it does not select the MS 3.6 DAO Object Library by default. You have to go into References and select it yourself in order to use the DAO library.

Paul
 
Thanks for your reply.

Your second point seems quite likely. What do you mean by "go into References"?

(The DAO object doesn't exist in the list either!)
 
To go into References, you would open any module in the Db, go to Tools....References and look for

Microsoft DAO 3.6 Object Library (for A2000, there may be a later version for XP). Then you select that library by adding a check mark in the box to the left(again this is how it was in 97 and 2000). That makes the library available for you to use. Then you use the declarations from my first post to reference that library.

Paul
 
Thanks mate! It worked! Heh! And the IT department didn't have a clue!!! ;o)
 
The IT department usually won't. Must be all that noise from the servers.
Glad to see MS hasn't done anything to make it easier either.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top