Validation Rule in SQL and Access

I need to write a validation rule for a field so that all entries into that field match with at least on entry in another table

If you are using MS-Access why not just set the field to use the type Lookup & Relationship?
The ability to restrict values and raise an error are built into Access already, in Access 2007-2010 you can click the arrow next to the field name and it will allow you to set that filed as a Lookup ... a wizard comes up and on the last page you'll see 'Enable Data Integrity' click that and for your case 'Restrict Delete' then you'll get an error when you try to enter something wrong.

Here's an office link for more details:
Create a Lookup Field

Validation rule for minus or dash symbol SQL ms Access

While editing table column in validation rule just enter

Not Like "*[-]*"


Related Topics



Leave a reply



Submit