Field Validation

  • Thread starter Thread starter Alex H
  • Start date Start date
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
 
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)
 
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]
 
Back
Top