View Full Version : parameter/variable criteria


cmrabide
07-20-2000, 11:08 AM
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

Pat Hartman
07-20-2000, 12:05 PM
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();

linda sciallo
10-02-2001, 08:22 AM
I had to do something similiar recently.

This worked like a charm!!

Thanks Pat.