I want to set a value using a variable

Stavi

New member
Local time
Today, 20:40
Joined
Aug 7, 2007
Messages
6
Me.ControlName = Variable

Ok, I know how to do that, but I want to do is

Me.Variable = Whatever

Can this be done, if so how?
 
Sorry one of us misunderstood

Variable = Me.ControlName - Wouldnt this change my variable? and I dont know what the control name is

I want to use the variable to say which control I am changing

Maybe I should of stated the variable is the control name
 
Oh, let me try again - see if I understand correctly. You want the variable to be the name of the control, not the value of the control. If that is correct, then it would be:

Variable = Me.ControlName.Name

And if you wanted to pass the name of the control to the variable based on the active control you should be able to use

Variable = Screen.ActiveControl.Name
 
TheVariable = "NameOfTheControl"

MsgBox me.controls(TheVariable).Value

me.controls(TheVariable).Value = "Some Other Value"
 
Sorry Bob Im not good at expaining things like this

Thx Roy, I understand your answer. Havnt tried it yet but i get the principle.
 

Users who are viewing this thread

Back
Top Bottom