I have an Access 2003 form with 58 checkboxes. Each checkbox has 2 corresponding combo boxes, which I would like to keep hidden until their box has been checked. The naming is consistent, with the checkboxes named "chkName" and the combo boxes named "cboName_Rating " and "cboName_Durati on".
Since there are so many checkboxes, I want to eliminate having to put a function call in the AfterUpdate event of each one. Here is what I am trying to use on the Form level, but cannot find the appropriate event to attach it to, if there is one:
I know the code is good because it will work on the last changed checkbox if the form is saved, but I can't get it working in real-time as each box is checked.
I am probably just creating more work in being lazy, but it seems like a good theory to me. Thanks in advance for any help!
Tony Leonard
Since there are so many checkboxes, I want to eliminate having to put a function call in the AfterUpdate event of each one. Here is what I am trying to use on the Form level, but cannot find the appropriate event to attach it to, if there is one:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim nm As String
Dim nmLong As String
If Me.ActiveControl.ControlType = acCheckBox Then
nm = Mid(Me.ActiveControl.Name, 4)
If Me.ActiveControl = -1 Then
nmLong = "cbo" & nm & "_Rating"
Me(nmLong).Visible = True
nmLong = "cbo" & nm & "_Duration"
Me(nmLong).Visible = True
Else
nmLong = "cbo" & nm & "_Rating"
Me(nmLong).Visible = False
nmLong = "cbo" & nm & "_Duration"
Me(nmLong).Visible = False
End If
End If
End Sub
I am probably just creating more work in being lazy, but it seems like a good theory to me. Thanks in advance for any help!
Tony Leonard
Comment