KAyers
Registered User.
- Local time
- Yesterday, 23:51
- Joined
- Oct 30, 2007
- Messages
- 23
Hello!
I have inherited a form that promised much but was short on delivery. At present I have checkboxes controlling combo boxes and buttons for 7 distinct sections of a form. Ultimately, upon creation of a new record, I would like to have the user see disabled boxes and buttons for all sections until they check the section 1 box. All other sections remain disabled until they too are checked- in any order they are checked, so they could enable section 1, 5, and then 3. Currently, all fields are disabled with the new record but once one checkbox is selected all of the fields are enabled, including those on new records. I have been doing a lot of research but most suggestions don't address multiple disabled sections or resetting for new records. I'm not sure where the original creator was coming from so I didn't want to monkey blindly. I'm sorry this is so long- any help would be greatly appreciated. Here is the original set up:
Private Sub Active1()
Dim Ex As Boolean
Dim ctrl As Control
On Error Resume Next
For Each ctrl In Me.Controls
ctrl.Enabled = True
Next ctrl
If Not Me!U1 Or Ex Then
Ex = True
Me.Unit1.Enabled = False
Me.Unit1Jack.Enabled = False
Me.AddUnit1.Enabled = False
End If
End Sub
Private Sub Active2()
Dim Ex As Boolean
Dim ctrl As Control
On Error Resume Next
For Each ctrl In Me.Controls
ctrl.Enabled = True
Next ctrl
If Not Me!A Or Ex Then
Ex = True
Me.ConnectorAX.Enabled = False
Me.AddConnector1.Enabled = False
Me.BackshellAX.Enabled = False
Me.AddBackshell1.Enabled = False
Me.CableTypeA.Enabled = False
Me.AddCable1.Enabled = False
Me.CableALength.Enabled = False
Me.ConnectorAY.Enabled = False
Me.AddConnector2.Enabled = False
Me.BackshellAY.Enabled = False
Me.AddBackshell2.Enabled = False
End If
End Sub
Private Sub Active3()
Dim Ex As Boolean
Dim ctrl As Control
On Error Resume Next
For Each ctrl In Me.Controls
ctrl.Enabled = True
Next ctrl
If Not Me!P1 Or Ex Then
Ex = True
Me.Plate1.Enabled = False
Me.AddPlate1.Enabled = False
Me.Plate1Receptacle.Enabled = False
Me.Plate1Jack.Enabled = False
End If
End Sub
Private Sub Active4()
Dim Ex As Boolean
Dim ctrl As Control
On Error Resume Next
For Each ctrl In Me.Controls
ctrl.Enabled = True
Next ctrl
If Not Me!B Or Ex Then
Ex = True
Me.ConnectorBX.Enabled = False
Me.AddConnector3.Enabled = False
Me.BackshellBX.Enabled = False
Me.AddBackshell3.Enabled = False
Me.EMICategoryB.Enabled = False
Me.AddEMICategory1.Enabled = False
Me.CableTypeB.Enabled = False
Me.AddCable2.Enabled = False
Me.CableBLength.Enabled = False
Me.ConnectorBY.Enabled = False
Me.AddConnector4.Enabled = False
Me.BackshellBY.Enabled = False
Me.AddBackshell4.Enabled = False
End If
End Sub
Private Sub Active5()
Dim Ex As Boolean
Dim ctrl As Control
On Error Resume Next
For Each ctrl In Me.Controls
ctrl.Enabled = True
Next ctrl
If Not Me!P2 Or Ex Then
Ex = True
Me.Plate2.Enabled = False
Me.AddPlate2.Enabled = False
Me.Plate2Receptacle.Enabled = False
Me.Plate2Jack.Enabled = False
End If
End Sub
Private Sub Active6()
Dim Ex As Boolean
Dim ctrl As Control
On Error Resume Next
For Each ctrl In Me.Controls
ctrl.Enabled = True
Next ctrl
If Not Me!C Or Ex Then
Me.ConnectorCX.Enabled = False
Me.AddConnector5.Enabled = False
Me.BackshellCX.Enabled = False
Me.AddBackshell5.Enabled = False
Me.CableTypeC.Enabled = False
Me.AddCable3.Enabled = False
Me.CableCLength.Enabled = False
Me.ConnectorCY.Enabled = False
Me.AddConnector6.Enabled = False
Me.BackshellCY.Enabled = False
Me.AddBackshell6.Enabled = False
End If
End Sub
Private Sub Active7()
Dim Ex As Boolean
Dim ctrl As Control
On Error Resume Next
For Each ctrl In Me.Controls
ctrl.Enabled = True
Next ctrl
If Not Me!U2 Or Ex Then
Ex = True
Me.Unit2.Enabled = False
Me.Unit2Jack.Enabled = False
Me.AddUnit2.Enabled = False
End If
End Sub
Private Sub U1_AfterUpdate()
Active1
End Sub
Private Sub A_AfterUpdate()
Active2
End Sub
Private Sub P1_AfterUpdate()
Active3
End Sub
Private Sub B_AfterUpdate()
Active4
End Sub
Private Sub P2_AfterUpdate()
Active5
End Sub
Private Sub C_AfterUpdate()
Active6
End Sub
Private Sub U2_AfterUpdate()
Active7
End Sub
I have inherited a form that promised much but was short on delivery. At present I have checkboxes controlling combo boxes and buttons for 7 distinct sections of a form. Ultimately, upon creation of a new record, I would like to have the user see disabled boxes and buttons for all sections until they check the section 1 box. All other sections remain disabled until they too are checked- in any order they are checked, so they could enable section 1, 5, and then 3. Currently, all fields are disabled with the new record but once one checkbox is selected all of the fields are enabled, including those on new records. I have been doing a lot of research but most suggestions don't address multiple disabled sections or resetting for new records. I'm not sure where the original creator was coming from so I didn't want to monkey blindly. I'm sorry this is so long- any help would be greatly appreciated. Here is the original set up:
Private Sub Active1()
Dim Ex As Boolean
Dim ctrl As Control
On Error Resume Next
For Each ctrl In Me.Controls
ctrl.Enabled = True
Next ctrl
If Not Me!U1 Or Ex Then
Ex = True
Me.Unit1.Enabled = False
Me.Unit1Jack.Enabled = False
Me.AddUnit1.Enabled = False
End If
End Sub
Private Sub Active2()
Dim Ex As Boolean
Dim ctrl As Control
On Error Resume Next
For Each ctrl In Me.Controls
ctrl.Enabled = True
Next ctrl
If Not Me!A Or Ex Then
Ex = True
Me.ConnectorAX.Enabled = False
Me.AddConnector1.Enabled = False
Me.BackshellAX.Enabled = False
Me.AddBackshell1.Enabled = False
Me.CableTypeA.Enabled = False
Me.AddCable1.Enabled = False
Me.CableALength.Enabled = False
Me.ConnectorAY.Enabled = False
Me.AddConnector2.Enabled = False
Me.BackshellAY.Enabled = False
Me.AddBackshell2.Enabled = False
End If
End Sub
Private Sub Active3()
Dim Ex As Boolean
Dim ctrl As Control
On Error Resume Next
For Each ctrl In Me.Controls
ctrl.Enabled = True
Next ctrl
If Not Me!P1 Or Ex Then
Ex = True
Me.Plate1.Enabled = False
Me.AddPlate1.Enabled = False
Me.Plate1Receptacle.Enabled = False
Me.Plate1Jack.Enabled = False
End If
End Sub
Private Sub Active4()
Dim Ex As Boolean
Dim ctrl As Control
On Error Resume Next
For Each ctrl In Me.Controls
ctrl.Enabled = True
Next ctrl
If Not Me!B Or Ex Then
Ex = True
Me.ConnectorBX.Enabled = False
Me.AddConnector3.Enabled = False
Me.BackshellBX.Enabled = False
Me.AddBackshell3.Enabled = False
Me.EMICategoryB.Enabled = False
Me.AddEMICategory1.Enabled = False
Me.CableTypeB.Enabled = False
Me.AddCable2.Enabled = False
Me.CableBLength.Enabled = False
Me.ConnectorBY.Enabled = False
Me.AddConnector4.Enabled = False
Me.BackshellBY.Enabled = False
Me.AddBackshell4.Enabled = False
End If
End Sub
Private Sub Active5()
Dim Ex As Boolean
Dim ctrl As Control
On Error Resume Next
For Each ctrl In Me.Controls
ctrl.Enabled = True
Next ctrl
If Not Me!P2 Or Ex Then
Ex = True
Me.Plate2.Enabled = False
Me.AddPlate2.Enabled = False
Me.Plate2Receptacle.Enabled = False
Me.Plate2Jack.Enabled = False
End If
End Sub
Private Sub Active6()
Dim Ex As Boolean
Dim ctrl As Control
On Error Resume Next
For Each ctrl In Me.Controls
ctrl.Enabled = True
Next ctrl
If Not Me!C Or Ex Then
Me.ConnectorCX.Enabled = False
Me.AddConnector5.Enabled = False
Me.BackshellCX.Enabled = False
Me.AddBackshell5.Enabled = False
Me.CableTypeC.Enabled = False
Me.AddCable3.Enabled = False
Me.CableCLength.Enabled = False
Me.ConnectorCY.Enabled = False
Me.AddConnector6.Enabled = False
Me.BackshellCY.Enabled = False
Me.AddBackshell6.Enabled = False
End If
End Sub
Private Sub Active7()
Dim Ex As Boolean
Dim ctrl As Control
On Error Resume Next
For Each ctrl In Me.Controls
ctrl.Enabled = True
Next ctrl
If Not Me!U2 Or Ex Then
Ex = True
Me.Unit2.Enabled = False
Me.Unit2Jack.Enabled = False
Me.AddUnit2.Enabled = False
End If
End Sub
Private Sub U1_AfterUpdate()
Active1
End Sub
Private Sub A_AfterUpdate()
Active2
End Sub
Private Sub P1_AfterUpdate()
Active3
End Sub
Private Sub B_AfterUpdate()
Active4
End Sub
Private Sub P2_AfterUpdate()
Active5
End Sub
Private Sub C_AfterUpdate()
Active6
End Sub
Private Sub U2_AfterUpdate()
Active7
End Sub