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
 
Back
Top