469,631 Members | 1,218 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

Date Validation

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
3 1308
Stewart Ross
2,545 Expert Mod 2GB
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
3,080 Expert 2GB
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
ramdil
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.

Similar topics

30 posts views Thread by Dr John Stockton | last post: by
reply views Thread by Brian Conway | last post: by
7 posts views Thread by Paul | last post: by
12 posts views Thread by Diego | last post: by
1 post views Thread by Brendan Reynolds | last post: by
3 posts views Thread by =?Utf-8?B?Q2hyaXM=?= | last post: by
2 posts views Thread by John Smith | last post: by
Stang02GT
5 posts views Thread by Stang02GT | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.