473,385 Members | 1,506 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Cannot jump to variable definition

I've been asked to take over maintenance of a database. The client
has also requested that I split the database into Front End/Back End.
I've just taken delivery of the code and I've run it and it all seems
to work well. The code contains a function to create, copy and delete
queries on the fly. For these all to be available to all users I have
taken a look at the current code to do the copying.

And I've run up against a weird problem. There is a line in the code:

DoCmd.CopyObject , TempString, acQuery, QryID

The definition for QryID is not in the function, nor in the form's
module, so I right-clicked on it and selected "Definition". This
produces a message that states:

"Cannot jump to 'QryID' because it is in the library 'C:\Projects
\ThisProject\ThisDatabase.mdb' which is not currently referenced."

Needless to say, I am working in 'C:\Projects\ThisProject
\ThisDatabase.mdb. I've looked in Tools, References and there are no
missing references. I've tried adding a reference and recompiling and
no luck. I did notice that the name of the database in the properties
pane when selecting the top node in the Project Explorer in the Code
window was Access9.mdb, but I've changed it to ThisDatabase.mdb and
still the same error.

Thoughts?

Edward
Jun 27 '08 #1
6 5977
te********@hotmail.com wrote:
I've been asked to take over maintenance of a database. The client
has also requested that I split the database into Front End/Back End.
I've just taken delivery of the code and I've run it and it all seems
to work well. The code contains a function to create, copy and delete
queries on the fly. For these all to be available to all users I have
taken a look at the current code to do the copying.

And I've run up against a weird problem. There is a line in the code:

DoCmd.CopyObject , TempString, acQuery, QryID

The definition for QryID is not in the function, nor in the form's
module, so I right-clicked on it and selected "Definition". This
produces a message that states:

"Cannot jump to 'QryID' because it is in the library 'C:\Projects
\ThisProject\ThisDatabase.mdb' which is not currently referenced."

Needless to say, I am working in 'C:\Projects\ThisProject
\ThisDatabase.mdb. I've looked in Tools, References and there are no
missing references. I've tried adding a reference and recompiling and
no luck. I did notice that the name of the database in the properties
pane when selecting the top node in the Project Explorer in the Code
window was Access9.mdb, but I've changed it to ThisDatabase.mdb and
still the same error.

Thoughts?

Edward
What is the value of TempString and what is the value of QryID? Is
QryID passed to the function or is it assigned a value like
QryID = "SomeTableOrQueryName"

Here's an example from help.
DoCmd.CopyObject, "Employees Copy", acTable, "Employees"

Jun 27 '08 #2
On 2 Jun, 15:34, Salad <o...@vinegar.comwrote:
[...]
>
What is the value of TempString and what is the value of QryID? *Is
QryID passed to the function or is it assigned a value like
* * * * QryID = "SomeTableOrQueryName"

Here's an example from help.
DoCmd.CopyObject, "Employees Copy", acTable, "Employees"- Hide quoted text-
The values are irrelevant. I'm just trying to find out where QryID is
declared. It's used in the function and elsewhere in the code behind
the form, but I can't find where it's declared. My current suspicion
is that it's actually a hidden control on the form's design surface,
and the developer hasn't prepended it with the Me keyword.

Edward
Jun 27 '08 #3
Let's compare your line and Access Help's example

Yours:
DoCmd.CopyObject , TempString, acQuery, QryID

It seems QryId must be "a string expression that's the valid name of
an object of the type selected by the sourceobjecttype argument."

Access Example:
DoCmd.CopyObject, "Employees Copy", acTable, "Employees"

Let's check in Northwinds;
DoCmd.CopyObject , "new query", acQuery, "Inventory" - works
DoCmd.CopyObject , "new query", acQuery, Inventory - error:
Compile error:
Expected variable or procedure, not module

Somewhere in some type library VBA has an object named Inventory and
it's a module, and VBA expects a string in the place Inventory is
being used (or a function [procedure] the returns a string, so it
can't use a module.

When I ask for the definition of Inventory it opens and shows the
Module called "Inventory", not the Query named "Inventory"

So what if it said it points to the something in the Library DB
Esmerelda. That would mean that at sometime somewhere there was a
Library DB named Library Esmerelda referenced by this DB and that the
type library still thinks this Library is still pertinent. But in your
case the Library is the DB itself. Perhaps, in days gone by, this DB
was a Library servicing another DB and VBA got confused. VBA often
gets confused. A recompile may de-confuse VBA.

But you can't do a recompile while QryId is undefined.

So what to do?

If you can see what string QryID is supposed to be, you have only to
declare QryId and point it at the string.

Then recompile. That may lead you to other problems.

If you can't see what string it is, you could comment out the line and
recompile and see where that leads and tell us.

BTW, I'm trying to imagine a situation where one would want to write a
utility to copy queries, but I can't. IMO If you have a crap db, no
amount of bandaiding will make it a good db. Start Over.


On Jun 2, 8:13*am, teddysn...@hotmail.com wrote:
I've been asked to take over maintenance of a database. *The client
has also requested that I split the database into Front End/Back End.
I've just taken delivery of the code and I've run it and it all seems
to work well. *The code contains a function to create, copy and delete
queries on the fly. *For these all to be available to all users I have
taken a look at the current code to do the copying.

And I've run up against a weird problem. *There is a line in the code:

DoCmd.CopyObject , TempString, acQuery, QryID

The definition for QryID is not in the function, nor in the form's
module, so I right-clicked on it and selected "Definition". *This
produces a message that states:

"Cannot jump to 'QryID' because it is in the library 'C:\Projects
\ThisProject\ThisDatabase.mdb' which is not currently referenced."

Needless to say, I am working in 'C:\Projects\ThisProject
\ThisDatabase.mdb. *I've looked in Tools, References and there are no
missing references. *I've tried adding a reference and recompiling and
no luck. *I did notice that the name of the database in the properties
pane when selecting the top node in the Project Explorer in the Code
window was Access9.mdb, but I've changed it to ThisDatabase.mdb and
still the same error.

Thoughts?

Edward
Jun 27 '08 #4
On Jun 2, 5:37*pm, lyle fairfield <lyle.fairfi...@gmail.comwrote:
Let's compare your line and Access Help's example

Yours:
DoCmd.CopyObject , TempString, acQuery, QryID

It seems QryId must be "a string expression that's the valid name of
an object of the type selected by the sourceobjecttype argument."

Access Example:
DoCmd.CopyObject, "Employees Copy", acTable, "Employees"

Let's check in Northwinds;
DoCmd.CopyObject , "new query", acQuery, "Inventory" - works
DoCmd.CopyObject , "new query", acQuery, Inventory - error:
Compile error:
Expected variable or procedure, not module

Somewhere in some type library VBA has an object named Inventory and
it's a module, and VBA expects a string in the place Inventory is
being used (or a function [procedure] the returns a string, so it
can't use a module.

When I ask for the definition of Inventory it opens and shows the
Module called "Inventory", not the Query named "Inventory"

So what if it said it points to the something in the Library DB
Esmerelda. That would mean that at sometime somewhere there was a
Library DB named Library *Esmerelda referenced by this DB and that the
type library still thinks this Library is still pertinent. But in your
case the Library is the DB itself. Perhaps, in days gone by, this DB
was a Library servicing another DB and VBA got confused. VBA often
gets confused. A recompile may de-confuse VBA.

But you can't do a recompile while QryId is undefined.

So what to do?

If you can see what string QryID is supposed to be, you have only to
declare QryId and point it at the string.

Then recompile. That may lead you to other problems.

If you can't see what string it is, you could comment out the line and
recompile and see where that leads and tell us.

BTW, I'm trying to imagine a situation where one would want to write a
utility to copy queries, but I can't. IMO If you have a crap db, no
amount of bandaiding will make it a good db. Start Over.
I've found out what QryID is - it's a text box on a subform. There is
a good business reason for the utility to copy queries, believe it or
not. Thanks to all for the help.

Edward
Jun 27 '08 #5
Just as a matter of interest, if you can do so without revealing company
confidential information, I'd be eager to learn the good business reason for
copying queries.

Almost all valid business needs can be satisfied in multiple ways in
Access... so there might just be another way to accomplish the purpose that
is safer, or easier.

By the way, consistent use of a good naming convention might have made
finding QryID easier. "txtQryID", in my apps, would immediately be
identified as a Text Box, and "strQryID" as a string variable. A
widely-accepted naming convention in the Access world is the Reddick Naming
Convention, which you'll find documented at
http://www.xoc.net/standards/default.asp.

Larry Linson
Microsoft Office Access MVP

<ed********@googlemail.comwrote in message
news:89**********************************@s50g2000 hsb.googlegroups.com...
On Jun 2, 5:37 pm, lyle fairfield <lyle.fairfi...@gmail.comwrote:
Let's compare your line and Access Help's example

Yours:
DoCmd.CopyObject , TempString, acQuery, QryID

It seems QryId must be "a string expression that's the valid name of
an object of the type selected by the sourceobjecttype argument."

Access Example:
DoCmd.CopyObject, "Employees Copy", acTable, "Employees"

Let's check in Northwinds;
DoCmd.CopyObject , "new query", acQuery, "Inventory" - works
DoCmd.CopyObject , "new query", acQuery, Inventory - error:
Compile error:
Expected variable or procedure, not module

Somewhere in some type library VBA has an object named Inventory and
it's a module, and VBA expects a string in the place Inventory is
being used (or a function [procedure] the returns a string, so it
can't use a module.

When I ask for the definition of Inventory it opens and shows the
Module called "Inventory", not the Query named "Inventory"

So what if it said it points to the something in the Library DB
Esmerelda. That would mean that at sometime somewhere there was a
Library DB named Library Esmerelda referenced by this DB and that the
type library still thinks this Library is still pertinent. But in your
case the Library is the DB itself. Perhaps, in days gone by, this DB
was a Library servicing another DB and VBA got confused. VBA often
gets confused. A recompile may de-confuse VBA.

But you can't do a recompile while QryId is undefined.

So what to do?

If you can see what string QryID is supposed to be, you have only to
declare QryId and point it at the string.

Then recompile. That may lead you to other problems.

If you can't see what string it is, you could comment out the line and
recompile and see where that leads and tell us.

BTW, I'm trying to imagine a situation where one would want to write a
utility to copy queries, but I can't. IMO If you have a crap db, no
amount of bandaiding will make it a good db. Start Over.
I've found out what QryID is - it's a text box on a subform. There is
a good business reason for the utility to copy queries, believe it or
not. Thanks to all for the help.

Edward
Jun 27 '08 #6
On 3 Jun, 15:36, "Larry Linson" <boun...@localhost.notwrote:
Just as a matter of interest, if you can do so without revealing company
confidential information, I'd be eager to learn the good business reason for
copying queries.

Almost all valid business needs can be satisfied in multiple ways in
Access... so there might just be another way to accomplish the purpose that
is safer, or easier.

By the way, consistent use of a good naming convention might have made
finding QryID easier. "txtQryID", in my apps, would immediately be
identified as a Text Box, and "strQryID" as a string variable. A
widely-accepted naming convention in the Access world is the Reddick Naming
Convention, which you'll find documented athttp://www.xoc.net/standards/default.asp.
You're actually preaching to the choir - as I mentioned in my original
post I've been asked to take over the maintenance of this database.
It's not feasible to rename objects as I would name them (although the
tables are named with the tbl- prefix, which is a start). As an
aside, our company has decided to move away from the naming
convention, which is a right royal PITA when using SQL Server, as
prepending all your user objects with tbl- for tables, vw- for views,
stp- or sp- for SPROCs, fn- for UDFs means that they're all in one
place in the window.

But I digress. The reason for copying queries is because the database
is used by a small number of people of differing technical ability who
wish to share information in a quick and dirty way. Let's say you
decide you want a query that shows all customers who purchased widgets
in May 2007, the application allows you to do this and to save the
query. Now let's say that you want to know who purchased widgets in
June 2007, you just copy the query, rename it, and amend it to show
the new date range.

NB: I WOULDN'T HAVE DONE IT THIS WAY!!! But I didn't develop it, and
there's no budget to back out this modus operandi and do it
differently. Actually, it's one of the very few lacunae in Access -
the ability to build queries on the fly for non-techie users in code
(it does it ok using the wizards).

Edward
Jun 27 '08 #7

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

Similar topics

3
by: Thomas Matthews | last post by:
Hi, While coding programs, I cam about a conundrum regarding variables defined in an iterative loop. The issue is whether it is more efficient to factor the definition out of the loop or...
8
by: Vijay | last post by:
Hi all, Im using gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-20) on 64bit linux server im trying to compile following code --------------------sam.cpp--------------------- #include...
10
by: Jean-David Beyer | last post by:
I have some programs running on Red Hat Linux 7.3 working with IBM DB2 V6.1 (with all the FixPacks) on my old machine. I have just installed IBM DB2 V8.1 on this (new) machine running Red Hat...
9
by: paul c | last post by:
Apologies if I'm sending this to the wrong group. If so I'd be grateful if somebody could point me to the right one. I'm using microsoft visual c++ 6.0 compiler. My code is C, I just use the...
6
by: Todd A. Anderson | last post by:
I have a function foo of which I need to get the address. The problem is that when you say "&foo" (or just foo for that matter), you get the address of this function's entry in a jump table and...
1
by: esteban40oz | last post by:
I have 9 buttons on my form. Button1, Button2, Button3, etc I want to create an array to access the value of each of them. Dim buttonArray() As Button = {Button1, Button2, Button3, Button4,...
112
by: istillshine | last post by:
When I control if I print messages, I usually use a global variable "int silent". When I set "-silent" flag in my command line parameters, I set silent = 1 in my main.c. I have many functions...
11
by: whirlwindkevin | last post by:
I saw a program source code in which a variable is defined in a header file and that header file is included in 2 different C files.When i compile and link the files no error is being thrown.How is...
13
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post by:
This is a follow-up to my post "Silverlight video doesn't work when file is streamed from handler in ASP.net" at...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.