I, too, suggest the after update event for the combo boxes.
Rules:
When a contract changes, clear Task Order, ClIN, txtIndHours and txtCovHours fields, then set the enabled status of txtIndHours and txtCovHours
When a Task Order changes, clear ClIN, txtIndHours and txtCovHours fields, then set the enabled status of txtIndHours and txtCovHours
When a ClIN field changes, set the enabled status of txtIndHours and txtCovHours
In a COPY of your dB, try the following code. Comment out the "_click" events.
Code:
Private Sub cboContractNum_AfterUpdate()
' Me.cboContractNum = Me.cboContractNum.Column(0) '<<-- setting a control equal to itself???
Me.txtContractor = Me.cboContractNum.Column(1)
Me.txtMATO = Me.cboContractNum.Column(2)
'changes made to the contract so clear the combo boxes
Me.cboTO = Null
Me.cboTO.Requery
Me.cboCLIN = Null
Me.cboCLIN.Requery
'since you don't know at this point if Individual or Coverage position,
' clear txtCovHours and txtIndHours controls and disable both
Me.txtCovHours = Null 'or maybe 0 (zero)
Me.txtCovHours.Enabled = False
Me.txtIndHours = Null 'or maybe 0 (zero)
Me.txtIndHours.Enabled = False
End Sub
Private Sub cboTO_AfterUpdate()
Me.txtTOStart = Me.cboTO.Column(1)
Me.txtTOEnd = Me.cboTO.Column(2)
Me.txtMTF = Me.cboTO.Column(3)
Me.txtCOR = Me.cboTO.Column(4)
Me.cboCLIN.Requery
'since you don't know at this point if Individual or Coverage position,
' clear txtCovHours and txtIndHours controls and disable both
Me.txtCovHours = Null 'or maybe 0 (zero)
Me.txtCovHours.Enabled = False
Me.txtIndHours = Null 'or maybe 0 (zero)
Me.txtIndHours.Enabled = False
End Sub
Private Sub cboCLIN_AfterUpdate()
Me.txtLaborCat = Me.cboCLIN.Column(3)
Me.txtSite = Me.cboCLIN.Column(4)
Me.txtClinic = Me.cboCLIN.Column(5)
Me.txtIndCov = Me.cboCLIN.Column(6)
If Me.txtIndCov = "Individual" Then
Me.txtCovHours = Null 'or maybe 0 (zero)
Me.txtCovHours.Enabled = False
Else
Me.txtIndHours = Null 'or maybe 0 (zero)
Me.txtIndHours.Enabled = False
End If
End Sub
You also might need code in the form current event:
Code:
Private Sub Form_Current()
Me.txtIndHours.Enabled = Me.txtIndCov = "Individual"
Me.txtCovHours.Enabled = Not (Me.txtIndCov = "Individual")
' If Me.txtIndCov = "Individual" Then
' Me.txtIndHours.Enabled = True
' Me.txtCovHours.Enabled = False
' Else
' Me.txtIndHours.Enabled = False
' Me.txtIndHours.Enabled = True
' End If
End Sub