Solved

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

Posted on 2004-09-17
3
293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
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…

751 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