Loop thru controls
I have a form that has 20 hidden combo boxes on them and based on the event of a visible combobox I want to turn certain ones on and the rest off.
Each has the same name with a suffix of a number
I can make them visible well enough using Select Case, but I need to make them invisible right before I make the corect ones visible on subsequent times and I don't want to hard code every one. I thought that I would just put a loop at the top before the Select and turn them all in visible then let the individual Case statement make visible the one it needs. But I can't seem to get the syntax right.
I have the code:
Dim FormCounter As Integer
Dim z As String
For FormCounter = 1 To 20
z = "lblLable_" & FormCounter
'This, and the next lines, is what I am trying to automate with the next line--> Me.lblLable_1.Visible = False
Forms!F_ToolingTypeSelectionForReport! & z & .Visible = False
Me.lblLable_1.caption = ""
Me.cbxFrom_1.Visible = False
Me.cbxThru_1.Visible = False
Next FormCounter
How can I automate this? I am getting tripped on "Forms" line of code not being parsed correctly.
__________________
__________________
Mitch
|