Reference a variable from a variable

BigJimSlade

Registered User.
Local time
Today, 10:13
Joined
Oct 11, 2000
Messages
173
Hey Big Jim here!

Is it possible to reference a variable from a variable? Example:

Dim strA as string
Dim strB as string
Dim strC as string

strA = "strB"
Value of strA = strC 'In other words, setting strB = strC using the value of strA

Did that make any sense?

Thanks in advance!

Big Jim
 
BigJim,

For controls, you can: Me.Controls(strA)
For recordsets, you can: rst.Fields(strA)

In VBA coding, I think your best shot is the Eval function.

Wayne
 
Hi Wayne,

Thanks, as that makes great sense when dealing with recordsets and controls. I will be able to use that in the future.

However, what about variables? Is there a control array or something for variables? I am looking to set strB by referencing it in strA.

strA (which has a value of "strB") = strC which would mean that strB = strC

Thanks again!

Big Jim
 
Big Jim,

As far as I know, VBA is not like 'C', and does not support pointers.
You can pass arguments by reference (to modify them). But expressing
a variable as something that another variable points to is not allowed.

I think there was a thread here about parsing equations. Maybe do a
search here on equation.

Wayne
 
Many thanks Wayne! Big Jim has learned alot today thanks to you.

Regards,

Big Jim
 

Users who are viewing this thread

Back
Top Bottom