Referencing Global Variable from a variable 
Author Message
 Referencing Global Variable from a variable

I have a module containing a number of Public string
variables.  If I refer directly to them, there is no
problem.  ie.
offno = "001"

I would like to know if there is any way to refer to them
with a variable. ie

variablename = "offno"

something.something.(variablename) = "001".

I have made it work by using a case statement. ie.

Select Case variablename
     Case "offno"
          offno = "001"


This is not what I am looking for.  It seems that there
should be a way to do it with that one line.  If there is,
I would just like to know how to do it.
(I have referred to textboxes on a form with:
Forms!FormName.Controls.(textboxname).Visible = True
It just seems like there should be something similar for
global variables in a module.

Fri, 14 Jan 2005 23:13:48 GMT  
 Referencing Global Variable from a variable
Using a recoredset list of variable names, I can loop
through the list and assign values to some properties of
textboxes on a form:

textboxname = "Inp" & rs!variablename
Forms!Form1.Controls.(textboxname).visible = True

This works nicely.  I have a module (Globals) with some
global variables to which I would like to refer in the
same way. ie:

globalvariablename = rs!variablename
something.something.variablename = "001"

I have a working solution for moving the data to the
globals using a case statement with two lines for each
global variable.  I just seems that there should be some
direct way of doing it the way I can refer to the
textboxes.  Can it be done and how?

Fri, 14 Jan 2005 23:29:47 GMT  
 [ 2 post ] 

 Relevant Pages 

1. How to reference a global variable?

2. Reference global variable in another template?

3. Referencing Global Variables in a Data Enviornment

4. Expanding a variable or referencing a field within variable

5. reference contents of variable as a variable...

6. Global Variables / Global Objects

7. print variable, variable, variable etc

8. how to show a global variable in a report

9. Use multiple API calls or Global public variable?

10. Global variables in VBA

11. Global Variable

12. VB Global Variable


Powered by phpBB® Forum Software