Referential Integrity (1 Viewer)

Stephanie T.

Registered User.
Local time
Yesterday, 21:57
Joined
Jun 20, 2002
Messages
60
I am having a strange problem I cannot figure out. I have a main form for sales orders, with a subform where the products sold is entered. On the subform, there is a combo box for the products. I have created a one-to-many relationship (with enforced referential integrity checked) between the sales order detail table and the products table, this is what drives the combo box. However, when I pick a product on the subform, this message comes up:

You can’t add or change a record because a related record is required in table “tblProducts”

This doesn’t make any sense to me, since I am choosing a product name from the combo box that is driven by the Products table.

This seems to be a common problem for me when I set up enforced referential integrity, does anyone know what is causing this? I’m using Access 97.

Thank you,
Stephanie
 

SimonC

Registered User.
Local time
Today, 05:57
Joined
Feb 25, 2002
Messages
48
I assume that the relationship between the two tables is based on some kind of ID field in each case but the combo box is displaying a decription of some sort.

Could it be that you're either not passing the ProductID to the combo box at all, or that you are, but the column it's in isn't set as the bound column?

For example, if the row source for the product combo is something like SELECT ProductID, ProductDescription FROM tblProducts, you'd set the bound column to 1, the column count to 2 and the column width (assuming you don't want to see the ID in the drop-down) to "0;" (without the quotes).

Any help?

Simon
 

Stephanie T.

Registered User.
Local time
Yesterday, 21:57
Joined
Jun 20, 2002
Messages
60
Simon,

Thank you! It all seems to be working great now!

Best to you,
Stephanie
 

Users who are viewing this thread

Top Bottom