By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,362 Members | 3,489 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,362 IT Pros & Developers. It's quick & easy.

Date Validation

P: 46
Hi All
I have a small requirement.I have column called payment date in my system.Now i want a validation as follows.
when someone enters a payment date for over a weekend or bank holiday then it show a message its a holiday.How can it be done.I know some weekday functions are available but will it give me bank holidays or sat or sundays..Can any please give some idea on it.One idea in my mind is to create a table which stores all these dates and validate against it,but i feel it is not so proffessional.
Thanks in advance
May 16 '08 #1
Share this Question
Share on Google+
3 Replies


Expert Mod 2.5K+
P: 2,545
Hi Ramdil. You have two requirements here. The first relates to Sundays and Saturdays, which can be done by checking the day for the date entered using the Weekday function to return the day, as the skeleton here shows:
Expand|Select|Wrap|Line Numbers
  1. Dim DayofWeek as Integer
  2. DayofWeek = WeekDay(somedate)
  3. If DayofWeek = vbSaturday or DayofWeek = vbSunday then
  4.   {do stuff}
  5. else
  6.   {do something else}
  7. endif
For bank holidays there is no choice but to use a table holding the specific dates, as these are not in any way under Access's control. Bank holiday dates vary each year, and some vary locally according to region. There is nothing unprofessional about using lookup tables for such values - there is no other way to do so.

-Stewart
May 16 '08 #2

nico5038
Expert 2.5K+
P: 3,072
This link may provide some insight as it's calculating working days with such a holiday table:
http://www.mvps.org/access/datetime/date0006.htm

Very nice other samples there too :-)

Nic;o)
May 16 '08 #3

P: 46
Hi Thanks for you valuable help.


Hi Ramdil. You have two requirements here. The first relates to Sundays and Saturdays, which can be done by checking the day for the date entered using the Weekday function to return the day, as the skeleton here shows:
Expand|Select|Wrap|Line Numbers
  1. Dim DayofWeek as Integer
  2. DayofWeek = WeekDay(somedate)
  3. If DayofWeek = vbSaturday or DayofWeek = vbSunday then
  4.   {do stuff}
  5. else
  6.   {do something else}
  7. endif
For bank holidays there is no choice but to use a table holding the specific dates, as these are not in any way under Access's control. Bank holiday dates vary each year, and some vary locally according to region. There is nothing unprofessional about using lookup tables for such values - there is no other way to do so.

-Stewart
May 19 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.