Converting string variable to a control name

S

Simon Cleal

Access2K

Is there a way to convert the value of a string variable into a control name?
 
A

Allen Browne

If you have the name of a variable in a string variable, you can use it to
refer to a control on the current form in VBA code like this:

Dim strControlName As String
strControlName = "City"
Me(strControlName) = "New York"
 
X

XMan

Another great tip!


Allen Browne said:
If you have the name of a variable in a string variable, you can use it to
refer to a control on the current form in VBA code like this:

Dim strControlName As String
strControlName = "City"
Me(strControlName) = "New York"
 
Top