Solved

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

Posted on 2004-09-17
3
284 Views
Last Modified: 2008-03-06
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
Comment
Question by:Drako357
  • 2
3 Comments
 
LVL 12

Expert Comment

by:pique_tech
ID: 12086473
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
 
LVL 13

Accepted Solution

by:
lucas911 earned 100 total points
ID: 12086488
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
 
LVL 12

Expert Comment

by:pique_tech
ID: 12086498
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

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Creating and Managing Databases with phpMyAdmin in cPanel.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now