Hi,
I set up a relationship between two tables with the itineraryid fields
in both tables:
tblDailyItinerary
tblDailyMeals
I have a form that writes a record to tblDailyItinerary that updates
the autonumber field itineraryid. I then bring up a subform which
writes a record to tblDailyMeals. Access tells me "You cannot add or
change a record because a related record is required in table
tblDailyItinerary".
Well, that is false because there IS a record in that table with the
same itineraryid value. I click OK and the record gets written any
way to the 2nd table (tblDailyMeals).
If I remove the relationship, it works just fine (no funky records).
Any ideas? The code to save the record is pretty straight forward:
Dim dbCurr_pw As Database
Dim rst As Recordset
Dim strFind_pw As String
Set dbCurr_pw = CurrentDb
Set rst = dbCurr_pw.OpenRecordset("tblDailyMeals")
With rst
.addnew
!ItineraryID = Me.txtItineraryID
!mealid = Me.txtMealId
!description = Me.txtDescription
.Update
End With
-paulw