I have 10 groups of controls on a report, and each group has 8 controls. I have labeled them in an array fashion: "vhs1field1","vhs1field2",.. "vhs[ i ]field[ j ]".
I want to be able to modify all of the fields in a single code loop, based on an associated yes/no button on another form. However, I cannot figure out the correct syntax. Here's what I am trying:
Dim I As Integer, J As Integer
Dim strLabel As String, strTapeNo As String
For I = 1 To 10 ' 10 labels per form
strTapeNo = "[Forms]![vhs_pick_label]![vhs" & I & "]"
For J = 1 To 8 ' 8 fields of interest
strLabel = "vhs" & I & "field" & J
Me![(strLabel)].Visible = Not ([(strTapeNo)])
Next J
Next I
For example, if the button for label 2 is deselected, the
report should cause controls 1-8 for that label to be
not visible.
The above syntax does NOT work, and I have tried many different variants.
Is it even possible to refer to controls using variables?
Thanks for any help!!
I want to be able to modify all of the fields in a single code loop, based on an associated yes/no button on another form. However, I cannot figure out the correct syntax. Here's what I am trying:
Dim I As Integer, J As Integer
Dim strLabel As String, strTapeNo As String
For I = 1 To 10 ' 10 labels per form
strTapeNo = "[Forms]![vhs_pick_label]![vhs" & I & "]"
For J = 1 To 8 ' 8 fields of interest
strLabel = "vhs" & I & "field" & J
Me![(strLabel)].Visible = Not ([(strTapeNo)])
Next J
Next I
For example, if the button for label 2 is deselected, the
report should cause controls 1-8 for that label to be
not visible.
The above syntax does NOT work, and I have tried many different variants.
Is it even possible to refer to controls using variables?
Thanks for any help!!