• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

User-defined type not defined (dim db as Database)

I've been using an access database at work and recently loaded it on my home PC, but can't seem to get it to recognize a variable as a Database.  I tried to match up my references, but my computer does not contain the same list (missing Microsoft Common Controls 5.0 and 6.0).
0
Drako357
Asked:
Drako357
  • 2
1 Solution
 
pique_techCommented:
You have to uncheck the missing references to get all your functions to work right.  Ideally, if you're going to use those two libraries, then you should get them for your home computer too.
0
 
LucasMS Dynamics DeveloperCommented:
Add this reference to your module:

Microsoft DAO 3.6 Object Library

And in your code to declare your database variable and your recordset variable do it like this:

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

0
 
pique_techCommented:
It also helps to disambiguate your variable declations by declaring which library they're from, i.e., "dim db as DAO.Database" or "dim rs as ADODB.Recordset"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now