Moving through Controls on a Form

  • Thread starter Thread starter Surveyor in VA via AccessMonster.com
  • Start date 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
 
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?
 
Back
Top