passing values into query criteria

  • Thread starter Thread starter james
  • Start date Start date
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...
 
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.
 
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?
 
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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top