A
Ann in CA
Hello,
I'm trying to save a query that will test to see if there are two global
variables set up or not. If there is a value in the variable, I will use it
as criteria; if not, no. My first problem comes when trying to use the
variable. I found this on this site:
Unfortunately, when I try this, I get error 2482, "My database can't fine
the name 'glUsername' you entered in the expression."
And yes, I've declared glusername as a variable and entered a value in it.
TIA.
I'm trying to save a query that will test to see if there are two global
variables set up or not. If there is a value in the variable, I will use it
as criteria; if not, no. My first problem comes when trying to use the
variable. I found this on this site:
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]
Unfortunately, when I try this, I get error 2482, "My database can't fine
the name 'glUsername' you entered in the expression."
And yes, I've declared glusername as a variable and entered a value in it.
TIA.