Need Business Days Only-No Weekends

B

Bonnie

Hello all. Using A02 on XP. Have a date field on my form
that I would like to tell me BeforeUpdate if that date is
a weekend day and ask would I like to change it before
exiting. I see in the Date functions there is a 'w'. Is
that where I need to be looking? How best to use it?

If I can ask for the moon, is there something out there
that can tell me if a certain date is a holiday or stock
market will be closed (I have a printed list but nothing
in a table). Should I just create a table each year and
have the date field check against it? Would love to hear
what you think is best to solve this one.

Reason for the request is I input future wire dates and
would LOVE to know if the date is 'good' or not.

Thanks in advance for any help or advice!!! LUV U GUYS!
 
G

Graham Mandeno

Hi Bonnie

The WeekDay function will return a number giving you the day of the week
(1=Sunday ... 7=Saturday) so a good test for a weekend is:
If WeekDay( somedate ) Mod 7 <= 1 Then ...

Holidays are different in every country (or even state) and many differ from
year to year (eg Easter), so the only reliable way to check is to load them
into a table with two fields: HolidayDate and HolidayName. You can then use
DLookup (or similar) to ascertain whether a given date is in your table.
 
B

Bonnie

Graham, thank you SO very much. You gave me the pointer to
set me straight. Using a nested IIF, I was able to have my
letter's query identify Sat/Sun dates and move them back
to Fri. I really appreciate the time you take to help
others. :)
-----Original Message-----
Hi Bonnie

The WeekDay function will return a number giving you the day of the week
(1=Sunday ... 7=Saturday) so a good test for a weekend is:
If WeekDay( somedate ) Mod 7 <= 1 Then ...

Holidays are different in every country (or even state) and many differ from
year to year (eg Easter), so the only reliable way to check is to load them
into a table with two fields: HolidayDate and HolidayName. You can then use
DLookup (or similar) to ascertain whether a given date is in your table.

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand


Hello all. Using A02 on XP. Have a date field on my form
that I would like to tell me BeforeUpdate if that date is
a weekend day and ask would I like to change it before
exiting. I see in the Date functions there is a 'w'. Is
that where I need to be looking? How best to use it?

If I can ask for the moon, is there something out there
that can tell me if a certain date is a holiday or stock
market will be closed (I have a printed list but nothing
in a table). Should I just create a table each year and
have the date field check against it? Would love to hear
what you think is best to solve this one.

Reason for the request is I input future wire dates and
would LOVE to know if the date is 'good' or not.

Thanks in advance for any help or advice!!! LUV U GUYS!


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top