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 / Forms Programming / April 2005

Tip: Looking for answers? Try searching our database.

Database not a recognized data type

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cwrightAGL - 30 Apr 2005 00:00 GMT
I am using Access 2003. When I use Dim db as Database,  I get a Compile Error
message telling me that the data type is not defined. How do I get around
this problem?

I am trying to open a recordset and I am using the following code:
Dim db As Database
Dim rstTemp As Recordset
       
   Set db = CurrentDb()
   Set rstTemp = db.OpenRecordset("WRTEST")

I tried not declaring db and using Set rstTemp =
CurrentDB.OpenRecordset("WRTEST") instead but that does not work....

Any ideas???
Jeff Conrad - 30 Apr 2005 00:33 GMT
> I am using Access 2003. When I use Dim db as Database,  I get a Compile Error
> message telling me that the data type is not defined. How do I get around
[quoted text clipped - 9 lines]
> I tried not declaring db and using Set rstTemp =
> CurrentDB.OpenRecordset("WRTEST") instead but that does not work....

That's odd.
The code you posted is most definitely DAO code and by default
Access 2003 does set a reference to the DAO object library. Did
you by chance remove this reference? We need to open up the
References dialog box to check. Follow these instructions:

To fix the References problem follow these steps:
- Open any module in Design view.
- On the Tools menu, click References.
- Scroll down to you get to Microsoft DAO 3.xx and check it.
- If you're using Access 97 that should be DAO 3.51 Object Library.
- If you're using Access 2000, 2002, or 2003 that should be DAO 3.6 Object Library.
- Close the References box again.
- Now re-compile again. Debug--Compile.
- Hopefully you should not see any more compile errors.

As good practice it may also be better to use this:

Dim db As DAO.Database
Dim rstTemp As DAO.Recordset

...rather than:

Dim db As Database
Dim rstTemp As Recordset

This helps to avoid confusion for Access (but you still have to manually
set a reference to DAO for 2000 and 2002) if you have a reference set
to both the DAO and ADO object libraries.

I hope that helps,
Signature

Jeff Conrad
Access Junkie
Bend, Oregon

cwrightAGL - 30 Apr 2005 01:04 GMT
Thank you so much. DAO was not selected in the Object Library. Once I
selected it everything was fine. Not sure how it got deselected... It may be
because I have 2 versions of Access (Access 97 and 2003) on my PC!

> > I am using Access 2003. When I use Dim db as Database,  I get a Compile Error
> > message telling me that the data type is not defined. How do I get around
[quoted text clipped - 41 lines]
>
> I hope that helps,
Jeff Conrad - 30 Apr 2005 06:09 GMT
> Thank you so much. DAO was not selected in the Object Library. Once I
> selected it everything was fine. Not sure how it got deselected... It may be
> because I have 2 versions of Access (Access 97 and 2003) on my PC!

You're very welcome, I'm glad I could help fix the problem.
Good luck with your project.

Signature

Jeff Conrad
Access Junkie
Bend, Oregon

 
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.