parameter/variable criteria

cmrabide

New member
Local time
Today, 13:17
Joined
Jul 20, 2000
Messages
8
I'm having problems using a public variable in the query criteria. I believe I have to code this in SQL view, but not exactly sure of the syntax (something to do with parameters?). I have the variable declared as public in a module. Thanks
 
You can't use public variables directly in a query. Jet has no way to evaluate them. Create a Public function that returns the variable and then use your function in the query.

Public Function MyVar()
MyVar = PublicVariable
End Function

Then in the query:
Select ...
From YourTable
Where TableField = MyVar();
 
I had to do something similiar recently.

This worked like a charm!!

Thanks Pat.
 

Users who are viewing this thread

Back
Top Bottom