Using variable names for controls

S

siddahuja

dim test as string
test="control1"

now, control1 is a textbox

i wanna use the name of the variable i.e. test to get the value of the textbox

i.e. msgbox(test.text)

can any one tell me how to do it?
 
R

Rick Brandt

siddahuja said:
dim test as string
test="control1"

now, control1 is a textbox

i wanna use the name of the variable i.e. test to get the value of
the textbox

i.e. msgbox(test.text)

can any one tell me how to do it?

MsgBox Me.Controls(test)

You don't want to use the Text property except in special circumstances as
that is the changed (but not yet updated) entry in the control with focus.
The Value property is the default and is what you would normally use.
 

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