Referential Integrity check failing, and can't figure out why

hotbot86

New member
Local time
Yesterday, 18:28
Joined
Dec 8, 2006
Messages
3
Hello I'm helping a friend with an access project and the Referential Integrity check is failing for some reason unknown to me. I recreated the entire database from scratch and added all relationships before adding any data and then added in the data. The tables giving me problems are the following:

Orders Table:
OrderID - Primary Key Autonumber, Format:\1000, Indexed: Yes(No Dupes)
CustID - Number, foreign key to a customers table, 1-many relationship
SalesID - Number, foreign key to a sales table, 1-many relationship
ShippingID - Number, foreign key to a shipping table, 1-many relationship
3 different date fields and a price field

This table is filled with data.

Order Details Table:
ItemID - Primary Key Autonumber, Indexed: Yes(no dupes)
OrderID - Number, Dec. Places: Auto, Required: Yes, Indexed: Yes(dupes OK)
RingID - foreign key to rings table, 1-many relationship
StoneID - foreign key to gemstones table, 1-many relationship
Ring Size - number

There is no data in the order details table.

The Orders to Order Details is a 1 to Many relationship with ref integrity and cascading updates and deletes enforced.

When I try to manually type in a record I get the "You cannot add or change a record because a related record is required in table 'Orders'" even though I added a lookup list box listing all the OrderIDs from the Order table. I know I'm typing in a valid OrderID number, but it's not taking it and throwing this error.

Any ideas why? You advice is greatly appriciated!

Thank you.
 
Have you set The Link Child Fields And Link Master Fields Correctly for the subform?
 
OK in messing with entering data manually through the subform on the Orders table it appears to work, however when I look at the Order Details table it appears to enter the OrderID as 40 instead of 1040 for example. I changed the Format of OrderID in the Order Details table to \1000 to mirror the orders table, only now the In the Orders Detail table, where I have a lookup combo box that pulls in the OrderIDs to enter, if I select 1040, it formats it to 11040 which won't work.

Thoughts?
 
I just scrapped the Format:/1000 on the OrderID of the Orders table and everything appears to work fine now.
 

Users who are viewing this thread

Back
Top Bottom