473,473 Members | 2,073 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

querydefs in 2000 vs 2003

I am using Access 2000, but my manual is for Access 2003. In 2003 you
can declare databases and querydefs as follows:

dim qdf as QueryDef
dim dbs as Database

but this doesn't seem to work in 2000. At least, I couldn't make it
work. I managed to create a new querydef, though, using the following
code:

Set querydef = CurrentDb.CreateQueryDef(qdefName, strSQL)

Question 1: is there a way to get the database name and store it as a
variable, so that the code would read:

dim dbs as Database
Set querydef = dbs.CreateQueryDef(qdefName, strSQL)

Question 2: If I create an alternate SQL string, what is the code to
identify the appropriate queryDef and replace the SQL string with the
alternate. Again, the 2003 example I have has me declare the querydef
name as a variable, and then use it in the code:

dim qdf as QueryDef

qdf.SQL = strAlternateSQL

I had declared a string variable as qDefName giving the name of the
query

qDefName.SQL = strAlternateSQL

but I get back the error "Invalid qualifier". So if I have an
existing query, how do I work with it as a queryDef in 2000?
Nov 16 '05 #1
2 4621
From your code window in Access 2000, choose References on the Tools menu.

Check the box beside:
Microsoft DAO 3.6 Library
The code will then work.

In their wisdom, Microsoft decided to leave out the DAO library reference
when you create a new database in Access 2002 or 2000. Fortunately, it's
back in 2003 as it was in all previous versions.

More on solveing problems with references:
http://allenbrowne.com/ser-38.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Donald Grove" <do*********@verizon.net> wrote in message
news:an********************************@4ax.com...
I am using Access 2000, but my manual is for Access 2003. In 2003 you
can declare databases and querydefs as follows:

dim qdf as QueryDef
dim dbs as Database

but this doesn't seem to work in 2000. At least, I couldn't make it
work. I managed to create a new querydef, though, using the following
code:

Set querydef = CurrentDb.CreateQueryDef(qdefName, strSQL)

Question 1: is there a way to get the database name and store it as a
variable, so that the code would read:

dim dbs as Database
Set querydef = dbs.CreateQueryDef(qdefName, strSQL)

Question 2: If I create an alternate SQL string, what is the code to
identify the appropriate queryDef and replace the SQL string with the
alternate. Again, the 2003 example I have has me declare the querydef
name as a variable, and then use it in the code:

dim qdf as QueryDef

qdf.SQL = strAlternateSQL

I had declared a string variable as qDefName giving the name of the
query

qDefName.SQL = strAlternateSQL

but I get back the error "Invalid qualifier". So if I have an
existing query, how do I work with it as a queryDef in 2000?

Nov 16 '05 #2
umm... if you're staying in the same DB the whole time, you don't have
to specify it. You can use
the properties and methods of CurrentDB
CurrentDB.Execute
CurrentDB.Querydefs("queryname")

Or you can use
DBEngine(0)(0).Execute
DBEngine(0)(0).Querydefs("queryname")

Nov 17 '05 #3

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

Similar topics

2
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
2
by: Jay Chan | last post by:
We have just installed a SQL Server 2000 (SP 3A) onto a computer that has Windows-2003 Server on it. Now, we cannot get access to that database server from other computers. Seem like this may be an...
2
by: Jeff | last post by:
Does anyone know of any potential problems running a 2000 database with 2003? Also, what about installing all other Office products as 2003 versions but leaving Access as 2002 running a 2000...
8
by: deko | last post by:
Is it possible to develop an Access app in Access 2003 that will run on Access 2000? Is it just a matter of selecting "Access 2000" from the Default File Format drop down list on the Advanced Tab...
14
by: MLH | last post by:
I have the following code to list query names in Access 2.0's Immediate Window. Currently, it lists names of all saved queries. Can you suggest a modification that will result in it listing only...
47
by: ship | last post by:
Hi We need some advice: We are thinking of upgrading our Access database from Access 2000 to Access 2004. How stable is MS Office 2003? (particularly Access 2003). We are just a small...
1
by: bobdydd | last post by:
Hi All I am using MS Office 2003 Word, Excel, Outlook, Front Page, Powerpoint, Visio. All except Access which I still use the 2000 version of. I am now ready to install the 2003 version of...
2
by: Tommy Hayes | last post by:
Hello all, I have the following code snippet in my Access app: Dim dbQueryDef As QueryDef Set dbQueryDef = CurrentDb.QueryDefs("QUERY_NAME") ' (1) Set dbQueryDef = CurrentDb.QueryDefs(26) '...
3
by: NEWSGROUPS | last post by:
I am in the midst of trying to convert about 25 Access 2000 to Access 2003. The new environment consists of Office/Access 2003 and Outlook 2003. When converting the back ends I have no problems....
0
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,...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.