S
Sharon
I've searched the FORMS discussion group and I can't find an answer to my
problem.
SITUATION
I have a form called EVENTS with a command button to bring up a form called
CHECKLIST. The forms are related via the EventID field (EVENTS is the one
side and CHECKLIST is the many). When the button is clicked, the correct
Checklist Form appears (that is, the one related to the Event from which it
was accessed) and the Event ID, Event Name, and Event Start Date fields
fill-in properly. The form also allows the user to complete the other fields
on the Checklist Form.
PROBLEM
When you try and save the Checklist Form, the following message appears:
"You cannot add or change a record because a related record is required in
table "Events"." I don't understand how this can be since the Events record
has to be completed first before the checklist AND when the checklist form is
accessed (as stated above), the correct ID#, name, and start date autofill.
I do have the referential integrity set to Yes.
Here is the code behind the button:
-------------------------------------------------------------------
Private Sub wiredchecklist_Click()
Dim opnfrm As Boolean
If Me.NewRecord = True Then
If Me.Dirty = True Then
Me.Dirty = False
opnfrm = True
End If
Else
opnfrm = True
End If
If opnfrm = True Then DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm "WIRED Checklist Form", , "[eventID]= " & [eventID]
End Sub
problem.
SITUATION
I have a form called EVENTS with a command button to bring up a form called
CHECKLIST. The forms are related via the EventID field (EVENTS is the one
side and CHECKLIST is the many). When the button is clicked, the correct
Checklist Form appears (that is, the one related to the Event from which it
was accessed) and the Event ID, Event Name, and Event Start Date fields
fill-in properly. The form also allows the user to complete the other fields
on the Checklist Form.
PROBLEM
When you try and save the Checklist Form, the following message appears:
"You cannot add or change a record because a related record is required in
table "Events"." I don't understand how this can be since the Events record
has to be completed first before the checklist AND when the checklist form is
accessed (as stated above), the correct ID#, name, and start date autofill.
I do have the referential integrity set to Yes.
Here is the code behind the button:
-------------------------------------------------------------------
Private Sub wiredchecklist_Click()
Dim opnfrm As Boolean
If Me.NewRecord = True Then
If Me.Dirty = True Then
Me.Dirty = False
opnfrm = True
End If
Else
opnfrm = True
End If
If opnfrm = True Then DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm "WIRED Checklist Form", , "[eventID]= " & [eventID]
End Sub