Form/subform error

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
 
S

Stefan Hoffmann

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 <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top