Full Version: Required Records
UtterAccess Forums > Microsoft® Access > Access Forms
PSUAlum
I have several FK's on a main form that I'm using. I keep getting messages saying "You cannot add or change a record because a related record is required in table 'tblX' ('tblX' referring to several of the tables where the FK resides). I've checked my tables and none of these are set as Required. What am I missing here?
theDBguy
Sounds like you have "Referential Integrity" turned on, which is good. What that error means is that you cannot add a record if the related record does not yet exists in its own table. For example, if you had a table of colors with data red and blue in it. Then in another table where you have info about cars, you cannot add a record for a white car because the color white is not yet in the color table. HTH
PSUAlum
Is the only way to avoid this to deactivate referential integrity for these particular relationships? If so, what are the consequences of doing this?
PSUAlum
I think I figured it out. A few of my FK's had a default value set to '0' instead of a blank. Oops :\
Jack Cowley
Be very sure that this really corrected the problem. In a One-to-Many relationship you should not be able to add a child record if there is no parent record and from your original post that is what it sounded like. The FK should be automatic and the default value should be 0. If you can add a child record when there is no parent record then your structure is not set up correctly...
My 3 cents worth...
Jack
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.