Weird Access Date Validation Problem

Soldato
Joined
18 Oct 2002
Posts
12,749
All,

trying to sort an access database which I need to only accept date set from now to 3 years in the future. (it can not be over 3 years in advance)

What validation code should I be using for this?
 
The simple answer is

Code:
Between Date() And DateAdd("yyyy",3,Date())

Although you might come across issues if you use this as a validation rule for a field in a table.
 
Fezzer said:
The simple answer is

Code:
Between Date() And DateAdd("yyyy",3,Date())

Although you might come across issues if you use this as a validation rule for a field in a table.

ok,

We need it to be used in a table for people booking the use of something, and the dates obv can only be Today or up to 3 years in the future, so with this scenario, where are we going wrong?
 
Imagine that you create a new record and put todays date in the validated field, it meets the validation criteria and all is well with the world!! Tomorrow you go back to that record to edit a field in it, but you are now unable to save the record as the date entered no longer meet the validation.

This sort of record validation really needs to be done, in a form for example, at the point of entry of the information rather than at table level.

Unless, of course, you are never going to edit any of the records once they have been entered!!

I hope this helps :)
 
Ive spoken to a few people, and the data wouldnt be edited after it had been entered (data will be entered through a form info the table I believe)

does that help?
 
As the validation is dynamic, i.e. the values will change with time, I would recommend that you do the validation on the form level as the data is entered and not on the table.
 
Back
Top Bottom