I am working on a database that users can use to input field collection data for an undergraduate course but keep running into a "related record is required..." problem in an associated dialog form.
The main form (frm_Trip) has data fields that get filled out, then the user clicks a button to open up the survey form (frm_BeltSurvey) which has the user-defined fields "cmbtransect" and "txtObservers," and a subform (frm_BeltSurveySub) that allows the user to select a species and count based on their survey observations. The error I keep getting is "You cannot add or change a record because a related record is required in table "tbl_Trip." This error doesn't occur if I add a record into tbl_Trip (through frm_Trip), close the form, open it back up, manually select the 'old' record, and then continue through the button click to the frm_BeltSurvey. So, I presume it isn't saving the record in frm_Trip before opening the dialog form, frm_BeltSurvey? Any suggestions? Ultimately there will be multiple buttons for different survey types but I'm just working on the Belt Survey first...the rest should easily follow suit once I get the design set for the one.
In case this might influence your suggestion, the 'on click' code used to link frm_Trip and frm_BeltSurvey is:
'Open Belt Survey form linked to Trip
DoCmd.OpenForm "frm_BeltSurvey", _
DataMode:=acFormAdd, _
WindowMode:=acDialog, _
OpenArgs:=(Me.TripID)
I've attached an image of where the code is showing up to accompany my explanation of the steps.
Attachment 22700