Field Validation

A

Alex H

Hi, in a table I have ytwo date fields. i want to put a validation on the
second field so that it cannot be earlioer than the first field. is this
possible please in a table design?

Thanks
Alex
 
A

Allen Browne

Yes, it's possible, but you cannot place this in the Validation Rule of one
of the fields, since you don't know which one will be filled in first.

For comparision between fields use the Validation Rule of the table--entered
in the Properties box (View menu in table design), not the Validation Rule
of the field (lower pane of the table design window.)

The validation rule could be:
EndDate >= StartDate

In earlier versions of Access that would have the side-effect of making both
fields required, so you might want to use:
(StartDate Is Null) OR (EndDate Is Null) OR (EndDate >= StartDate)
 
R

Rick Brandt

Alex said:
Hi, in a table I have ytwo date fields. i want to put a validation
on the second field so that it cannot be earlioer than the first
field. is this possible please in a table design?

Yes, but you have to use a *Table* validation rule, not a *Field* validation
rule because field validation rules are not allowed to reference other fields.

In the property sheet for the table in design view you will find a validation
rule. In that enter...

[SecondDateField] >= [FirstDateField]
 

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