Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't save - No related record? 2

Status
Not open for further replies.

Acipenser

Technical User
Oct 15, 2001
39
0
0
US
This should be easy, but has me totally confused. I am trying to save a record in frmLabNotes, but it won't allow the save because a related record was not found in tblCane. tblLabNotes and tblCane have a 1 to many relationship between the field SampleID and referential integrity is enforced. tblCane is the 1 side of the relationship.

What is confusing is that when I look in tblCane there is a record with the SampleID that is used in frmLabNotes. Why won't it save the record from frmLabNotes in tblLabNotes when there already is a SampleID in tblCane?

Thanks.
 
Maybe the record in tblCane has not been saved before entering the related record?

Dan
 
Dan,

Would the record appear in tblCane if it had not been saved?

Bill
 
I have had this problem before. What I did is delete the relationships within the relationship window. They are easy to re-add. Then go to the tables that relate with the forms and delete the record. That is giving you this problem. The reason why this is happening is because you have the ref int inforced. Then re-enter the data and re-draw the relationships. Hope this works. Now that I think about it you can force it in using this line of code behind the button that opens the form. DoCmd.RunCommand acCmdSaveRecord before the open line of code to the form.
 
Dan and Tofias1,

Thanks, now working!!

I put the command at the beginning of the OnClick event to open the next form and it worked perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top