I'm opening a form called frm400section from a switchboard using the acFormAdd and acFormDialogue arguments. There is a subform on this form called sbf400section. They are linked with a one-to-one relationship on a field called LogID which is a primary key autonumber field on the main form.
When I add a new record to frm400section I get this error: "Index or primary key cannot contain a null value." There is a Form_Current event on the subform that enables/disables fields based on values in other fields of the subform - I believe this code is the culprit. I've attached the code. Is there a way to open this form and allow the Form_Current event to work without error?
When I add a new record to frm400section I get this error: "Index or primary key cannot contain a null value." There is a Form_Current event on the subform that enables/disables fields based on values in other fields of the subform - I believe this code is the culprit. I've attached the code. Is there a way to open this form and allow the Form_Current event to work without error?
Code:
Private Sub Form_Current()
If cboAbsorber1.Value = 1 Then
Me.Absorber1Caustic.Enabled = True
Else
Me.Absorber1Caustic.Value = Null
Me.Absorber1Caustic.Enabled = False
End If
If cboAbsorber2.Value = 1 Then
Me.Absorber2Caustic.Enabled = True
Else
Me.Absorber2Caustic.Value = Null
Me.Absorber2Caustic.Enabled = False
End If
End Sub