473,386 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 1492
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

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

Similar topics

30
by: Dr John Stockton | last post by:
It has appeared that ancient sources give a method for Numeric Date Validation that involves numerous tests to determine month length; versions are often posted by incomers here. That sort of code...
0
by: Brian Conway | last post by:
I am having some validation and insertion problems. I am using a date picker that takes the selected date and puts it to ("dd-MMM-yyyy") format, as this was the only format that Oracle would...
7
by: Paul | last post by:
Hi, I have a form where a user is required to enter a start date and an end date. Both are required and must between a specific date range (e.g. 01/01/1900 and 01/01/2099) and the end date...
7
by: James P. | last post by:
Hello there, In my asp.net page using VB, I have a date text field in mm/dd/yyyy format. When a date is entered, I'd like to validate it to make sure the date is greater than or equal to the...
12
by: Diego | last post by:
Can I validate (possibly with a compare validator) a Date entered by the user based upon his regional settings? I.e. if a user is american the format would be mm/dd/yyyy, if brittish dd/mm/yyyy...
1
by: Brendan Reynolds | last post by:
In an ASP.NET 1.1 app I have the following range validation control. This is an intranet app that will be used only within Ireland, so all date input is expected to be in dd/mm/yyyy format. ...
17
by: Petyr David | last post by:
Just looking for the simplest. right now my perl script returns an error messge to the user if the date string is invalid. would like to do this before accessing the server. TX
3
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
I have VS 2005 (C#) There is a control numericUpDown so you can spin numeric values. What I need to do is to spin date (+- one day). How to do that? Moreover, I want a user to type the date as...
2
by: John Smith | last post by:
Hello, I have a VB.NET application with a Windows form that have several textboxes fields where I have dates entered. I would like to do a date validation check after the the field is updated, so...
5
Stang02GT
by: Stang02GT | last post by:
I have been asked to validate a date on our web-page so that people cannot enter dates like 14/1/08 or 2/30/06. I have found code that will do exactly what i need it to do, but i am not sure how to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.