Create constraint validation text (ADP)
Note The information in this topic applies only to a Microsoft Access project (.adp).
When your query encounters a constraint violation, by default Microsoft Access displays a message from Microsoft SQL Server. If your Access project is connected to a SQL Server 2000 database, you can create and show a more user-friendly message using the Validation Text property.
- In the Database window, click Tables under Objects, select the table you want, and then click Open on the database window toolbar.
- Right click on the Design grid, and then select Constraints.
- In the selected constraint list box, select the constraint you want, or click New to create a new constraint.
- Type the user message in the Validation Text text box as the following examples show.
If the constraint expression is: Type the validation text: MinJobLevel > 10
"The job level is too low. You must enter a number greater than 10." HouseholdName Is Not Null
"Please enter a household name."
Quantity >= 0
"You must enter a positive number." - Close the Properties sheet to save your changes.
Note The Validation Text property is ignored in an unbound form that fills in control values directly from ADO. In this case, you must trap the error and display the validation text in your code.