Date Validation

matthewnsarah07

Registered User.
Local time
Today, 12:00
Joined
Feb 19, 2008
Messages
192
I have got a table tblLeaveRequest which has 3 date fields in; [DateofRequest], [DateFrom] & [DateTo]

I want to add some validation rules to these fields:

[DateofRequest] - needs to restricted to dates no older than 10 days prior to system current date and no dates in the future at all

[DateFrom] - if possible to able to enter a date that is more than 12 months into the future

[DateTo] - cannot be before DateFrom field

Thanks for your help as always
 
You can't do this at table level. This type of validation needs to be done in a form.
 
Many Thanks

Now moved to Forms
 
I have got a table tblLeaveRequest which has 3 date fields in; [DateofRequest], [DateFrom] & [DateTo]

I want to add some validation rules to these fields:

[DateofRequest] - needs to restricted to dates no older than 10 days prior to system current date and no dates in the future at all

[DateFrom] - if possible to able to enter a date that is more than 12 months into the future

[DateTo] - cannot be before DateFrom field

Thanks for your help as always

Actually, this can be done, but the messages received when an entered date is out of range, are not very user friendly. I would not do it myself, but just in case anyone is interested, you can set Up Field Validation rules for the fields as follows:
[DateofRequest] - needs to restricted to dates no older than 10 days prior to system current date and no dates in the future at all
((>=DateSerial(Year(Now()),Month(Now()),Day(Now()))-10) And (<=Now()))
[DateFrom] - if possible to able to enter a date that is more than 12 months into the future
(>=DateSerial(Year(Now()),Month(Now())+12,Day(Now())))
[DateTo] - cannot be before DateFrom field
(>=[DateFrom])
Note: I noticed that this has moved to another thread, and I hope that matthewnsarah07 sees this if the interest is still there.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom