G
Guest
How can the condition in a query refer to a global variable?
How can the condition in a query refer to a global variable?
John Vinson said:Queries don't have direct access to VBA variables, global or not. You
need to write a dumb little wrapper function:
Public Function GetGlobal(varname as string) As Variant
GetGlobal = Eval(varname)
End Function
If the variable is named glUsername, you'ld put
GetGlobal("glUsername")
in the Criteria line of the query.
John W. Vinson[MVP]
Douglas J. Steele said:It can't. You'll have to create a function that returns the value of the
global variable.