473,698 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"Dim db as Database" generates an error

For some reason, "Database" isn't recognised by Access as a
built-in/predefined type, in Access' own VBA. Whenever I try to compile
a line like

Dim db as Database

I get the complaint that that user defined type ("database") isn't
defined. This happens both in Access 97 (on Win98) and in Access 2000
(on XP). I seem to recall this used to work on Access 2. For the rest,
Access works normally.

CurrentDB does seem to work, but I need to be able to pass a database as
a parameter, as I'm trying to relink tables to a moved/renamed .mdb file
by code, as is done in this sample code:

<http://www.mvps.org/access/tables/tbl0009.htm>

What also isn't recognised, is the constant "dbOpenForwardO nly", as
wanted by the dbOpenRecordset method.

Did I forget to install something? I did a scan for "DAO360.dll ", as
some sources would suggest I need, and I could only find copies in
strange subdirectories of the Windows directory, "ServicepackFil es" and
"SoftwareDistri bution", which strikes me as odd. And only on XP.

On Win98 I find a DLL called DDAO35.DLL which is in the System
subdirectory, which seems normal. Nevertheless, it still doesn't work.

What am I missing?

--
Bart.
Nov 13 '05 #1
3 16996
Bart Lateur <ba*********@pa ndora.be> wrote:
I get the complaint that that user defined type ("database") isn't
defined. This happens both in Access 97 (on Win98) and in Access 2000
(on XP). I seem to recall this used to work on Access 2. For the rest,
Access works normally.


Sounds like you're missing a DAO library reference. It's also good practice
to qualify the statement:

Dim db as DAO.Database

Regards,
Keith.
ww.keithwilby.c om
Nov 13 '05 #2
Bart Lateur wrote:
For some reason, "Database" isn't recognised by Access as a
built-in/predefined type, in Access' own VBA. Whenever I try to compile
a line like

Dim db as Database

I get the complaint that that user defined type ("database") isn't
defined. This happens both in Access 97 (on Win98) and in Access 2000
(on XP). I seem to recall this used to work on Access 2. For the rest,
Access works normally.


My suggestions:

Check your references (debug window, menu Tools->References) and uncheck
any marked as missing.

Put an explicit DAO.Database in your declaration

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #3
Bas Cost Budde wrote:
My suggestions:

Check your references (debug window, menu Tools->References) and uncheck
any marked as missing.
Bingo. "Microsoft DAO" wasn't checked (= available). Checking that fixed
it.
Put an explicit DAO.Database in your declaration


That, by itself, didn't help.

Thanks a million. That propblem has been nagging me for days.

--
Bart.
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
8686
by: Robin Tucker | last post by:
I have some code that dynamically creates a database (name is @FullName) and then creates a table within that database. Is it possible to wrap these things into a transaction such that if any one of the following fails, the database "creation" is rolledback. Otherwise, I would try deleting on error detection, but it could get messy. IF @Error = 0 BEGIN SET @ExecString = 'CREATE DATABASE ' + @FullName EXEC sp_executesql @ExecString
1
8071
by: Kenjis Kaan | last post by:
I had to run DB2 on Win2k. After installation it puts a directory under c:\DB2 and c:\DB2Log and C:\Program Files\SQLLIB Now am all confused which is instance home, db2 home etc. I had to configure tivoli inventory and its all *@#$ up because of this confusion. Can someone please clarify which is which? TIA c:\DB2>wgetrim invdh_1 RIM Host: user88 RDBMS User: user881 RDBMS Vendor: DB2
4
21551
by: Monte | last post by:
It compiles fine in one of my ms2002 databases, but on another db (I inherited from somebody else), I get this compile error: "User-defined type not defined" Is something turned off in this second db or something? Thanks much
2
5523
by: Terry Fleming | last post by:
I have upgrade a 97 access database to 2003. I have a vb6 front end that I am trying to connect to the database. I am getting the "3343 Unrecognized database" error. I checked the references and made sure that they are all matching. Does anyone have any advise on ow i can fix this -- Thanks
3
1905
by: Joanne | last post by:
I have searched through previous threads regarding this error. I went back through all my code to make sure I closed and set to nothing all open db's and rs's. However, I still have one computer getting this error. This problem does not occur with any other users - some of whom use the database continuously. The user logs in, then goes to the Add Invoice form - it's a fairly simple form, single table recordset with a subform based on...
0
4394
by: serge | last post by:
I have 2 SQL Enterprise Editions running SP2 and same collation. When i try to start database mirroring I get the following error message: "The remote copy of database "ABC" has not been rolled forward to a point in time that is emcompassed in the local copy of the database log. (Microsoft SQL Server, Error: 1412)" Both SQL Server services are running under account
0
4254
by: vaibhavsumant | last post by:
<project name="DBCreate" default="usage" basedir="."> <property name="user" value="db2admin"/> <property name="passwd" value="db2admin"/> <property name="dbprefix" value=""/> <property name="driver" value="COM.ibm.db2.jdbc.app.DB2Driver"/> <property name="starturl" value="jdbc:db2:temp"/> <property name="db2dir" location="${basedir}/../../../../.." /> <target name="CreateTestData" > <echo message="in mydbs db2dir = ${db2dir}" />
3
4132
by: FelixSmith | last post by:
I have recently posted a new access database and its oracle tables onto a shared folder for various users. It is a search database and me and a few other users are able to pull from the file and use it perfectly. But, when other users pull from the shared folder they suffer from dragging performance and then the fields within the forms error to "#Name?" and an "Object Invalid or No Longer Set" error button comes up. Seeing as though we...
11
4229
by: Anil Gupte/iCinema.com | last post by:
When I use this Dim instance As New Timer I get the error: Error 1 Overload resolution failed because no accessible 'New' accepts this number of arguments. Yet, in the help section for Timer (in VB 2005) this is exactly the syntax shown. I also tried:
0
8675
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9029
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7729
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.