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

dim db as DAO.DATABASE - User defined type not defined Error

Status
Not open for further replies.

Maggie24

IS-IT--Management
Jun 29, 2004
36
IE
Hi all,

I'm using the following code to UPDATE a record in my DB.


Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim STRsQL As String

Set db = CurrentDb
Set qdf = db.QueryDefs("query1")

STRsQL = "Update tblproducts set primary_material_no = '" & Combo59.Value & "' , secondary_material_no = '" & Cbo_subcategory.Value & "', Updated = 1 where [Product No] = '" & [Product No].Value & "'"

qdf.SQL = STRsQL
DoCmd.OpenQuery "query1"


Set qdf = Nothing
Set db = Nothing


But I am getting the error on the dim db as DAO.DATABASE line - User defined type not defined Error.

I have this code working in another program - can anyone tell me if i have forggoten a definition or something or do I need to change something in the DB properties??

Please help!

Maggie (Novice access user)
 
You need to add reference to the DAO Library:
Tools/ References, then look for Miscrosoft DAO 3.6 Obnject Library and select it.
Simon Rouse
 
In VBE - Tools | References - set a reference to Microsoft DAO 3.# Object library, btw is thread702-871657 resolved yet?

Here's a faq on how to get the most out of the membership faq181-2886.

Roy-Vidar
 
Simon, Roy,

adding that reference did the trick (i am slowly but surly learning the little things about access!)

Roy - Combo55.Requery also did the trick for my other problem.

Thank you both for your help and time,

Maggie May
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top