Can you reference a variable in a query?

intern42

Registered User.
Local time
Today, 06:00
Joined
May 28, 2003
Messages
24
Can you reference a variable in a query?

For instance, if I have an integer variable that is populated in a form's modual, can I have the form call a query that looks like:

SELECT ...
FROM ...
WHERE ... = intVariable;

Maybe [Forms]![Form name]![variable name]?
 
You have to use a function to get the value from a variable in a query:

Public Function MyVarValue ()
MyVarValue = MyVariable
End Function

SELECT ...
FROM ...
WHERE ... =MyVarValue();

hth,
Jack
 

Users who are viewing this thread

Back
Top Bottom