access 2002,
tblAddBook (1) To tblContacts (many)
add_id Primary key add_id foreign key
referential integrity with cascade
I have a main form (frmAssignContactToProject) that allows users to enter a new person, then on the subform (datasource is tblContacts) they can add many projects.
The error that is occuring is this, I have a cmd button that creates a new record. If the user starts on the many side (on the subform) access error pops up because it cannot find a matching record in tblAddbook. Also, it locks up the database and the user cannot exit without ctraltdelte.
My code below attempts to evaluate if the add_id is null, then send the user back to the main form, It seems to run okay, but I keep getting the access error message.
I THINK? that if I can disable the access message, run my code, then enable the access messages, it will run???
Have I got a clue??
Thanks for any help, Ron
Private Sub Form_Dirty(Cancel As Integer)
'deal with access error message,
'if user tries to create a record on the many side, of addbook to contacts
'notify user to start record with person rather than project,
'then set focus to the main form
If Me.tblAddBook_ADD_ID = Null Then
MsgBox "Please begin data entry with the Contact Information, then you may assign a project."
frmAssignContactToProject.FIRM_NAME.SetFocus
End If
End Sub
tblAddBook (1) To tblContacts (many)
add_id Primary key add_id foreign key
referential integrity with cascade
I have a main form (frmAssignContactToProject) that allows users to enter a new person, then on the subform (datasource is tblContacts) they can add many projects.
The error that is occuring is this, I have a cmd button that creates a new record. If the user starts on the many side (on the subform) access error pops up because it cannot find a matching record in tblAddbook. Also, it locks up the database and the user cannot exit without ctraltdelte.
My code below attempts to evaluate if the add_id is null, then send the user back to the main form, It seems to run okay, but I keep getting the access error message.
I THINK? that if I can disable the access message, run my code, then enable the access messages, it will run???
Have I got a clue??
Thanks for any help, Ron
Private Sub Form_Dirty(Cancel As Integer)
'deal with access error message,
'if user tries to create a record on the many side, of addbook to contacts
'notify user to start record with person rather than project,
'then set focus to the main form
If Me.tblAddBook_ADD_ID = Null Then
MsgBox "Please begin data entry with the Contact Information, then you may assign a project."
frmAssignContactToProject.FIRM_NAME.SetFocus
End If
End Sub