Dynamic Reference to Forms objects

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

I am trying to store a value in a form text box eg.
Text30 = 24

No problem but I want to build the name of the Text box
dynamically - something like :-

Dim aa as Integer
Dim ss as String
aa = 30

ss = "Text" & aa

eval(ss) = 24

That does not work but you can see what I am trying to do.

Can you help?
 
You can reference it through the controls collection:

dim intI as integer

'All of the following would assign the value of 22 to me.text30

int=30
me.text30=22
me.controls("text" & inti)=22
me("text" & inti)=22
 
Back
Top