Hi,
I set up a relationship between two tables with the itineraryid fields
in both tables:
tblDailyItinera ry
tblDailyMeals
I have a form that writes a record to tblDailyItinera ry 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
tblDailyItinera ry".
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.OpenR ecordset("tblDa ilyMeals")
With rst
.addnew
!ItineraryID = Me.txtItinerary ID
!mealid = Me.txtMealId
!description = Me.txtDescripti on
.Update
End With
-paulw
I set up a relationship between two tables with the itineraryid fields
in both tables:
tblDailyItinera ry
tblDailyMeals
I have a form that writes a record to tblDailyItinera ry 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
tblDailyItinera ry".
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.OpenR ecordset("tblDa ilyMeals")
With rst
.addnew
!ItineraryID = Me.txtItinerary ID
!mealid = Me.txtMealId
!description = Me.txtDescripti on
.Update
End With
-paulw
Comment