Moving through Controls on a Form

  • Thread starter Surveyor in VA via AccessMonster.com
  • Start date
S

Surveyor in VA via AccessMonster.com

Hello-

I have several text boxes on a form with the common naming prefix of "Mod0".
With these controls, I would like to change several of their properties,
including the position of the text box on the form and whether it is visible
or not.

I found this code here and am stuck on the how to reference the current
control to make visible or change the .top property.

Dim ctl as Control
For Each ctl In Me.Controls
If Left(ctl.Name, 4) = "Mod0" Then
<place code here>
End If
Next ctl

Set ctl = Nothing

I thought that under the <place code here>, I could put the following ctl.
Visible = False, but it gives me an error message. Any help would be greatly
appreciated.

Thanks,
CF
 
M

Marshall Barton

Surveyor said:
I have several text boxes on a form with the common naming prefix of "Mod0".
With these controls, I would like to change several of their properties,
including the position of the text box on the form and whether it is visible
or not.

I found this code here and am stuck on the how to reference the current
control to make visible or change the .top property.

Dim ctl as Control
For Each ctl In Me.Controls
If Left(ctl.Name, 4) = "Mod0" Then
<place code here>
End If
Next ctl

Set ctl = Nothing

I thought that under the <place code here>, I could put the following ctl.
Visible = False, but it gives me an error message.


ctl.Visible = False is the correct thing to use. Pehaps you
misspelled something or added an extra space or somethng?
 

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