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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2003 Form “Referential Integrity” error message!

Status
Not open for further replies.

MikeFL

Programmer
Jul 12, 2002
58
US
I have database program that has several “Tables” that have Referential Integrity relationships invoked to maintain data integrity. This data then populates the program “Form” fields via a “Combo Boxes”.

The user selects the data they want to populate the field with from one of the “Combo Box” choices. Once it’s selected the “Combo Box” closes and no errors pop-up on their computer screen.

The problem I have is when the user tries to enter data that was “NOT” found in the “Combo Box” dropdown. They get an error message like the one below, and they don’t know what to do!

Microsoft Access
You cannot add or change a record because a related record is required in table ‘TA-007’.


Question:
Is there a way to send the user an error message on their computer screen that is more descriptive when they exit that field that:

1. Informs the user which field name on the form has the data entry problem.

2. What the problem is.

3.How to fix it.
.........................................
Example of possible error message:

You have entered a name that does not exist in the “Assigned to Name” field. Please click on one of the names in the “Combo Box” drop-down list, or enter the new name in the Assigned to Name data table first.
 
A common way is to enforce ALL your validation rules in the BeforeUpdate event procedure of the form, playing with the SetFocus method and the Cancel parameter.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
How are ya MikeFL . . .

I have no Idea how your forms are setup, but your getting this message because is being entered in a form based on a [blue]child table (ForeignKey)[/blue], and there's no corresponding record in the [blue]parent table (PrimaryKey)![/blue]

In a typical Mainform with subform, if you goto a new record on the mainform & try to enter data in the subform first, you'll raise the same error!

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top