Passing Variable Name to a Function

B

Bob Howard

I have need to pass a variable name (to a function) which is actually a
string-type argument (or possibly a variant-type argument) that itself
contains the *NAME* of the variable I'm really interested in.

My application has a series of global variables where, at times, I need
access to their values from either a query or within the recordsource in a
control on a form or report. I could implement a function for each global
variable (to return its value) --- but I would prefer to "generalize" this
and have a common function that is capable of returning the value of any of
these global variables.

An example might be my global variable named gblProcessRouter. I want to
implement a function to return the value of gblProcessRouter as I refer to
its value in a query. Within a calculated field in the query, I want to
execute a function specifying something like:

getVariableValue("gblProcessRouter")

to return the value of gblProcessRouter.

What do I substitute for the ???????? to accomplish this?

Function getVariableValue(Variable_Name as String)
getVariableValue = ????????
End Function


Thanks in advance!

Bob (@Martureo_Org)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top