Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / May 2005

Tip: Looking for answers? Try searching our database.

Compile error: User-defined type not defined

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RIP - 08 May 2005 21:57 GMT
I am getting a compile error...  Can someone pls tell me what I am doing
wrong...

Private Sub Command5_Click()
Dim db As Database                 <<<----debugger highlights this yellow
Dim rctMakeAdd As Recordset

'*** Create a pointer to the database and a pointer to the table ***
Set db = CurrentDb()
Set rctMakeAdd = db.OpenRecordset("tblMake", dbOpenTable)

' ****Validate the Date field***
If IsNull(make) Or Len(make) = 0 Then
MsgBox "Please Enter a Make"
make.SetFocus
rctMakeAdd.Close
db.Close
Exit Sub
End If
Graham Mandeno - 08 May 2005 22:22 GMT
"Database" is an object which is declared in the Data Access Objects (DAO)
object library.

By default, Access 2000 gives new databases a reference to the ActiveX Data
Objects (ADO) library, and omits a reference to the DAO library.  (They have
reversed this change in later versions, thank goodness!)

From the code window, go to Tools->References.  Find and check:
   Microsoft DAO 3.x Object Library
(where "3.x" is the highest version you can see - probably 3.6)

If you are NOT using any ADO code anywhere in your database, you can uncheck
the reference to:
   Microsoft ActiveX Data Objects 2.x Library

It's a good idea to include an explicit "DAO." in your declarations, to
make it clear which object model you are using.  For example:
   Dim db as DAO.Database
   Dim rs as DAO.Recordset

This is not so essential for "Database", but both libraries have a
"Recordset", so the ambiguity can become a problem.

Signature

Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

>I am getting a compile error...  Can someone pls tell me what I am doing
> wrong...
[quoted text clipped - 15 lines]
> Exit Sub
> End If
RIP - 09 May 2005 06:05 GMT
That did it!!!! Thank you very much Graham!!!

Rgds.,
Walter


> "Database" is an object which is declared in the Data Access Objects (DAO)
> object library.
[quoted text clipped - 38 lines]
> > Exit Sub
> > End If
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.