Master / Detail form generates FK error upon save when both master and details contains new records

Posted on 2008-11-18
Medium Priority
Last Modified: 2012-05-05
I'm having a typical OrderForm with Order details in a datagridview like in the Northwind DB.

I create a dataset containing Order and Orderdetails.

I drag detils from Order and a gridviw from orderdetails under order.

When I run it, it works fine until I create a new order and enters order details. The temporary orderno -1 creates a foreign key error in orderdetails when I save. I thought the table adapter would take care of this for me?

Any suggestions?

Question by:ekenman
1 Comment

Accepted Solution

ekenman earned 0 total points
ID: 22983830
OK, I've got it. I've been sitting with this issue for two days and just becase I entered the question I found the solution.

In the Dataset Designer, right click the relation and choose Edit Relation.

Change the relation from Relation Only to Both Relation and Foreign Key Contraint.

Choose Update Rule to Cascade.

Now it works!

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question