passing values into query criteria

J

james

in short, is it possible?

say i have a query with 1 field and I want to pass a different integer
(user defined via input box) into the criteria section, can it be done?

i'm coding within access...
 
F

fredg

in short, is it possible?

say i have a query with 1 field and I want to pass a different integer
(user defined via input box) into the criteria section, can it be done?

i'm coding within access...

Do you mean you wish to be prompted to enter the criteria value?

In the Query, set the criteria for that column to:
[Enter a number]

If you mean something else, then perhaps explain a bit more.
 
J

james

yes, that is excellent!

what about if i wanted to set the variable somewhere else. could define
a global variable in some module, say "theCriteria" then just type
"theCriteria" into the criteria box when designing my Query?
 
J

james

james said:
yes, that is excellent!

what about if i wanted to set the variable somewhere else. could define
a global variable in some module, say "theCriteria" then just type
"theCriteria" into the criteria box when designing my Query?

to clarify... where "theCriteria" is a variable, not a module.
 
J

John Spencer

Can't do it exactly that way.

You can define a Global variable and set it.
Then you need to write a simple user function that returns the value of the
global variable and use the VBA user function to return the value to the
query.

Public Function getValue()
getValue = vSomePublicVariable
End Function
 
Top