Loop through controls

  • Thread starter Thread starter Paul Ilacqua
  • Start date Start date
P

Paul Ilacqua

I set up a "homemade" control array in a report and need to hide / show some
controls like Dat_1, Dat_2 etc. How can I loop through with a type loop.
For i = 1 to 10
"Dat_" & i = xxxx
Next i

Thanks
Paul
 
Dim i as Integer
Dim ctl as Control
For i = 1 to 10
Set ctl = Me("Dat_" & i)
'other code
Next
 
I think this is what you are aiming for:
Dim strCtlName As String
Dim i As Integer
For i = 1 to 10
strCtlName = "Dat_" & i
Me.Controls(strCtlName).Visible = False
Next i
 

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

Back
Top