How can I create variables to be used in query formula?

  • Thread starter Thread starter Jonny_C
  • Start date Start date
J

Jonny_C

Guest
I want to create a list of variables that I can use when I build formula in the expression builder; e.g a=5, b=6, c=10. How would I go about this? :confused:
 
If you are trying to access a variable directly in a query, the only options I can think of are to assign them to form fields (can be invisible fields) and reference them, or create a VBA function to return the value/s and use the function, or store them in a table of some kind.
 
Ok - thanks.

I think I will try creating variables and assigning values in VBA. :eek:
 
Be aware that the function you supply must be defined in a general module and declared public. (Public doesn't work in class modules - it's a contradiction in terms.)

Also, while this comes up from time to time, you may have limited yourself somewhere in a design. This USUALLY occurs because someone failed to read about parameter queries. (Admittedly, there are times when there is no better workaround than what you just requested.)

Search this forum for the topic "Variables in a query" and combinations of Variable and Query. Pat Hartman posted something on this subject within the last month. If Pat posted it, you can bet on it.
 

Users who are viewing this thread

Back
Top Bottom