Validation Rule

K

Kirko

Im trying to set a validation rule in a table that doesn't allow a duplicate
'Name' in a field where it shares the same 'JobID' in a previous record. I
not sure how to write it?
 
J

John Vinson

Im trying to set a validation rule in a table that doesn't allow a duplicate
'Name' in a field where it shares the same 'JobID' in a previous record. I
not sure how to write it?

You can't, not as a Validation Rule on a field - field validation
rules cannot reference other fields or other records in the table.

Instead, create a unique Index by opening the Indexes tool (lightning
hitting a datasheet in the table design toolbar); put a name for the
index in the left column, and select the [Name] and [JobID] fields in
the right column. Specify that the index should be unique.

Note that Name is a reserved word - Access can get confused between
the Name of the Name field vs. the Name in the Name field, not to
mention the Name of the table containing the Name field. (If you find
this confusing you know how the JET database engine must feel!)

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top