VBA Code Basics

  • Thread starter Thread starter Angus
  • Start date Start date
A

Angus

I have a form which contains three text box controls (text1, text2 & text3).
Those three text boxes are all set to Visible = False. Now, I would like to
write code to make them all visible at a time through looping. Below is the
code

For x = 1 to 3
Me!["text" & x].visible = True
Next x

The above coding doesn't work, as the Access can't read the name of the
control. How can I fix it?

Thank you very much.

Angus
 
It works. Thank you so much.


Van T. Dinh said:
Try:

Me.Controls("text" & x).Visible = True

--
HTH
Van T. Dinh
MVP (Access)



Angus said:
I have a form which contains three text box controls (text1, text2 & text3).
Those three text boxes are all set to Visible = False. Now, I would like to
write code to make them all visible at a time through looping. Below is the
code

For x = 1 to 3
Me!["text" & x].visible = True
Next x

The above coding doesn't work, as the Access can't read the name of the
control. How can I fix it?

Thank you very much.

Angus
 
Back
Top