Form/subform error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Me again….I have a form/subform problem. When I have a new record, I get an
“Index or primary key cannot contain a Null value†error when I edit the
subform and the main form is empty. What’s the best approach to solve this
problem. I was thinking of locking the subform until the required fields have
been entered in the main form.....how would I do this?

Any thoughts?
Glenn
 
hi Glenn,

Glenn said:
Me again….I have a form/subform problem. When I have a new record, I get an
“Index or primary key cannot contain a Null value†error when I edit the
subform and the main form is empty. What’s the best approach to solve this
problem. I was thinking of locking the subform until the required fields have
been entered in the main form.....how would I do this?
Set AllowInsert to False in the property editor. In the On Current event
of the main form you can set it to True:

Private Sub Form_Current

frmSubForm.AllowInsert = Not IsNull(Me![PrimaryKey])

End Sub

mfG
--> stefan <--
 
Back
Top