Hello all,
I have a 2 column table that looks like such
1 apple
2 banana
3 orange
4 tomato
5 strawberry
This table could have up to 15 rows but may have as few as 3.
On my main form I have an option group with 15 toggles and values of 1-15. I would like to make the togglebuttons.v isible = false for rows 6-15 in the above example. I guess I could run 15 dlookups but I was wondering if there was a better solution.
Playing with this but I'm (still) learning Access so it don't work:
table: tblSections
option group: grpSections
Dim intX As Integer
Dim ctl As Control
intX = DCount("*", "tblSection s")
MsgBox (intX)
For Each ctl In Me.Controls("gr pSections")
If TypeOf ctl Is ToggleButton And ctl.Value > intX Then
ctl.Visible = False
End If
Next ctl
I would very much appreciate any help you can provide.
WORKING NOW:
Dim intcount As Integer
Dim ctl As Control
intcount = DCount("*", "tblSection s")
For Each ctl In Me.Controls
If TypeOf ctl Is ToggleButton Then
If ctl.Tag > intcount Then
ctl.Visible = False
Else
ctl.Visible = True
End If
End If
Next ctl
I have a 2 column table that looks like such
1 apple
2 banana
3 orange
4 tomato
5 strawberry
This table could have up to 15 rows but may have as few as 3.
On my main form I have an option group with 15 toggles and values of 1-15. I would like to make the togglebuttons.v isible = false for rows 6-15 in the above example. I guess I could run 15 dlookups but I was wondering if there was a better solution.
Playing with this but I'm (still) learning Access so it don't work:
table: tblSections
option group: grpSections
Dim intX As Integer
Dim ctl As Control
intX = DCount("*", "tblSection s")
MsgBox (intX)
For Each ctl In Me.Controls("gr pSections")
If TypeOf ctl Is ToggleButton And ctl.Value > intX Then
ctl.Visible = False
End If
Next ctl
I would very much appreciate any help you can provide.
WORKING NOW:
Dim intcount As Integer
Dim ctl As Control
intcount = DCount("*", "tblSection s")
For Each ctl In Me.Controls
If TypeOf ctl Is ToggleButton Then
If ctl.Tag > intcount Then
ctl.Visible = False
Else
ctl.Visible = True
End If
End If
Next ctl