PC Review


Reply
Thread Tools Rate Thread

How do I determine the last business day of the month?

 
 
Paul Fenton
Guest
Posts: n/a
 
      24th May 2007
We have an application where a certain report must be run by the
bookkeeper on the last day of the month. If that day is a Saturday,
Sunday or holiday, the report is run the next business day. This
report has to be run before anyone updates the database with any new
information on the clients.

What I want to do is, when the application is started, check to see if
today is the last day of the month and if it is, alert the user to not
do any edits until the bookkeeper prints her report. Once she prints
her report, I can set a "yes" flag in a table that it's been done and
the warning won't show up anymore. Sometime after the 1st of the
month I would set that flag back to "no".

I can probably figure out how to determine if today is the last day of
the month, but I'm not sure how to deal with the weekend/holiday issue
and the issue of Leap Years.

I could use some direction as to how to attack this problem.


Paul Fenton
 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      24th May 2007
We use a holiday table to handle holidays. Our business day
function uses VBA WeekDay function to see if the date is
Saturday or Sunday, (Moves to the next business day, checks
to see if that is in the same month, if not moves backwards
one day at a time, checking for weekends), and then using
Dlookup to check to see if the date is in the holiday table.

Of course you have to put the holidays into the table for this
to work.

The last day of this month is
lastday = DateSerial(Year(date),Month(date)+1,-1)

You will have to check forward each day, because as well
as knowing if this is the last day, you will want to know if
the next business day is after the last day. Most days you
can stop after checking that (1) today is not last day and
(2) today is not friday and (3) tommorow is not a holiday

(david)


"Paul Fenton" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> We have an application where a certain report must be run by the
> bookkeeper on the last day of the month. If that day is a Saturday,
> Sunday or holiday, the report is run the next business day. This
> report has to be run before anyone updates the database with any new
> information on the clients.
>
> What I want to do is, when the application is started, check to see if
> today is the last day of the month and if it is, alert the user to not
> do any edits until the bookkeeper prints her report. Once she prints
> her report, I can set a "yes" flag in a table that it's been done and
> the warning won't show up anymore. Sometime after the 1st of the
> month I would set that flag back to "no".
>
> I can probably figure out how to determine if today is the last day of
> the month, but I'm not sure how to deal with the weekend/holiday issue
> and the issue of Leap Years.
>
> I could use some direction as to how to attack this problem.
>
>
> Paul Fenton



 
Reply With Quote
 
Graham Mandeno
Guest
Posts: n/a
 
      24th May 2007
Hi Paul/David

Minor correction - I suspect a typo, David :-)

> The last day of this month is
> lastday = DateSerial(Year(date),Month(date)+1,-1)


The last argument should be 0 not -1.

The zeroth day of the month is the day before the first day, i.e. the last
day of the previous month.
--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

<david@epsomdotcomdotau> wrote in message
news:%23qS$(E-Mail Removed)...
> We use a holiday table to handle holidays. Our business day
> function uses VBA WeekDay function to see if the date is
> Saturday or Sunday, (Moves to the next business day, checks
> to see if that is in the same month, if not moves backwards
> one day at a time, checking for weekends), and then using
> Dlookup to check to see if the date is in the holiday table.
>
> Of course you have to put the holidays into the table for this
> to work.
>
> The last day of this month is
> lastday = DateSerial(Year(date),Month(date)+1,-1)
>
> You will have to check forward each day, because as well
> as knowing if this is the last day, you will want to know if
> the next business day is after the last day. Most days you
> can stop after checking that (1) today is not last day and
> (2) today is not friday and (3) tommorow is not a holiday
>
> (david)
>
>
> "Paul Fenton" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> We have an application where a certain report must be run by the
>> bookkeeper on the last day of the month. If that day is a Saturday,
>> Sunday or holiday, the report is run the next business day. This
>> report has to be run before anyone updates the database with any new
>> information on the clients.
>>
>> What I want to do is, when the application is started, check to see if
>> today is the last day of the month and if it is, alert the user to not
>> do any edits until the bookkeeper prints her report. Once she prints
>> her report, I can set a "yes" flag in a table that it's been done and
>> the warning won't show up anymore. Sometime after the 1st of the
>> month I would set that flag back to "no".
>>
>> I can probably figure out how to determine if today is the last day of
>> the month, but I'm not sure how to deal with the weekend/holiday issue
>> and the issue of Leap Years.
>>
>> I could use some direction as to how to attack this problem.
>>
>>
>> Paul Fenton

>
>



 
Reply With Quote
 
Paul Fenton
Guest
Posts: n/a
 
      24th May 2007
David, thank you for the response. This gives me a starting point.

Can you give me a little more information on your Holiday table? I
assume that you have to maintain it for the movable dates such as
Thanksgiving, Labor Day, etc. When you do that, do you use the full
date such as mm/dd/yyyy or just month and day? Is it something like:

New Years 1/1
Memorial Day 5/28
Christmas 12/25
etc.


Paul Fenton

On Thu, 24 May 2007 09:51:26 +1000, <david@epsomdotcomdotau> wrote:

>We use a holiday table to handle holidays. Our business day
>function uses VBA WeekDay function to see if the date is
>Saturday or Sunday, (Moves to the next business day, checks
>to see if that is in the same month, if not moves backwards
>one day at a time, checking for weekends), and then using
>Dlookup to check to see if the date is in the holiday table.
>
>Of course you have to put the holidays into the table for this
>to work.
>
>The last day of this month is
>lastday = DateSerial(Year(date),Month(date)+1,-1)
>
>You will have to check forward each day, because as well
>as knowing if this is the last day, you will want to know if
>the next business day is after the last day. Most days you
>can stop after checking that (1) today is not last day and
>(2) today is not friday and (3) tommorow is not a holiday
>
>(david)
>
>
>"Paul Fenton" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> We have an application where a certain report must be run by the
>> bookkeeper on the last day of the month. If that day is a Saturday,
>> Sunday or holiday, the report is run the next business day. This
>> report has to be run before anyone updates the database with any new
>> information on the clients.
>>
>> What I want to do is, when the application is started, check to see if
>> today is the last day of the month and if it is, alert the user to not
>> do any edits until the bookkeeper prints her report. Once she prints
>> her report, I can set a "yes" flag in a table that it's been done and
>> the warning won't show up anymore. Sometime after the 1st of the
>> month I would set that flag back to "no".
>>
>> I can probably figure out how to determine if today is the last day of
>> the month, but I'm not sure how to deal with the weekend/holiday issue
>> and the issue of Leap Years.
>>
>> I could use some direction as to how to attack this problem.
>>
>>
>> Paul Fenton

>

 
Reply With Quote
 
Guest
Posts: n/a
 
      24th May 2007
Our holiday table has a date field, a text field, a country field,
and an autonumber primary key field. and some other stuff.

We have a separate entry for Christmas in every year, in
every country. (Most users only maintain a few countries).
In most countries there are only few fixed date holidays
anyway: lunar holidays like Easter, or 1st Tuesday in November
are more common, and the fixed holidays are the easy ones
anyway.

We don't support state/province holidays. No one has missed
that feature. Local people put their own holidays into the
national table (so they don't work), and ignore other state/province
holidays (because the financial system continues to work on
those days)

(david)

"Paul Fenton" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> David, thank you for the response. This gives me a starting point.
>
> Can you give me a little more information on your Holiday table? I
> assume that you have to maintain it for the movable dates such as
> Thanksgiving, Labor Day, etc. When you do that, do you use the full
> date such as mm/dd/yyyy or just month and day? Is it something like:
>
> New Years 1/1
> Memorial Day 5/28
> Christmas 12/25
> etc.
>
>
> Paul Fenton
>
> On Thu, 24 May 2007 09:51:26 +1000, <david@epsomdotcomdotau> wrote:
>
> >We use a holiday table to handle holidays. Our business day
> >function uses VBA WeekDay function to see if the date is
> >Saturday or Sunday, (Moves to the next business day, checks
> >to see if that is in the same month, if not moves backwards
> >one day at a time, checking for weekends), and then using
> >Dlookup to check to see if the date is in the holiday table.
> >
> >Of course you have to put the holidays into the table for this
> >to work.
> >
> >The last day of this month is
> >lastday = DateSerial(Year(date),Month(date)+1,-1)
> >
> >You will have to check forward each day, because as well
> >as knowing if this is the last day, you will want to know if
> >the next business day is after the last day. Most days you
> >can stop after checking that (1) today is not last day and
> >(2) today is not friday and (3) tommorow is not a holiday
> >
> >(david)
> >
> >
> >"Paul Fenton" <(E-Mail Removed)> wrote in message
> >news:(E-Mail Removed)...
> >> We have an application where a certain report must be run by the
> >> bookkeeper on the last day of the month. If that day is a Saturday,
> >> Sunday or holiday, the report is run the next business day. This
> >> report has to be run before anyone updates the database with any new
> >> information on the clients.
> >>
> >> What I want to do is, when the application is started, check to see if
> >> today is the last day of the month and if it is, alert the user to not
> >> do any edits until the bookkeeper prints her report. Once she prints
> >> her report, I can set a "yes" flag in a table that it's been done and
> >> the warning won't show up anymore. Sometime after the 1st of the
> >> month I would set that flag back to "no".
> >>
> >> I can probably figure out how to determine if today is the last day of
> >> the month, but I'm not sure how to deal with the weekend/holiday issue
> >> and the issue of Leap Years.
> >>
> >> I could use some direction as to how to attack this problem.
> >>
> >>
> >> Paul Fenton

> >



 
Reply With Quote
 
Paul Fenton
Guest
Posts: n/a
 
      25th May 2007
Thanks, David.

On Fri, 25 May 2007 08:51:15 +1000, <david@epsomdotcomdotau> wrote:

>Our holiday table has a date field, a text field, a country field,
>and an autonumber primary key field. and some other stuff.
>
>We have a separate entry for Christmas in every year, in
>every country. (Most users only maintain a few countries).
>In most countries there are only few fixed date holidays
>anyway: lunar holidays like Easter, or 1st Tuesday in November
>are more common, and the fixed holidays are the easy ones
>anyway.
>
>We don't support state/province holidays. No one has missed
>that feature. Local people put their own holidays into the
>national table (so they don't work), and ignore other state/province
>holidays (because the financial system continues to work on
>those days)
>
>(david)
>
>"Paul Fenton" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> David, thank you for the response. This gives me a starting point.
>>
>> Can you give me a little more information on your Holiday table? I
>> assume that you have to maintain it for the movable dates such as
>> Thanksgiving, Labor Day, etc. When you do that, do you use the full
>> date such as mm/dd/yyyy or just month and day? Is it something like:
>>
>> New Years 1/1
>> Memorial Day 5/28
>> Christmas 12/25
>> etc.
>>
>>
>> Paul Fenton
>>
>> On Thu, 24 May 2007 09:51:26 +1000, <david@epsomdotcomdotau> wrote:
>>
>> >We use a holiday table to handle holidays. Our business day
>> >function uses VBA WeekDay function to see if the date is
>> >Saturday or Sunday, (Moves to the next business day, checks
>> >to see if that is in the same month, if not moves backwards
>> >one day at a time, checking for weekends), and then using
>> >Dlookup to check to see if the date is in the holiday table.
>> >
>> >Of course you have to put the holidays into the table for this
>> >to work.
>> >
>> >The last day of this month is
>> >lastday = DateSerial(Year(date),Month(date)+1,-1)
>> >
>> >You will have to check forward each day, because as well
>> >as knowing if this is the last day, you will want to know if
>> >the next business day is after the last day. Most days you
>> >can stop after checking that (1) today is not last day and
>> >(2) today is not friday and (3) tommorow is not a holiday
>> >
>> >(david)
>> >
>> >
>> >"Paul Fenton" <(E-Mail Removed)> wrote in message
>> >news:(E-Mail Removed)...
>> >> We have an application where a certain report must be run by the
>> >> bookkeeper on the last day of the month. If that day is a Saturday,
>> >> Sunday or holiday, the report is run the next business day. This
>> >> report has to be run before anyone updates the database with any new
>> >> information on the clients.
>> >>
>> >> What I want to do is, when the application is started, check to see if
>> >> today is the last day of the month and if it is, alert the user to not
>> >> do any edits until the bookkeeper prints her report. Once she prints
>> >> her report, I can set a "yes" flag in a table that it's been done and
>> >> the warning won't show up anymore. Sometime after the 1st of the
>> >> month I would set that flag back to "no".
>> >>
>> >> I can probably figure out how to determine if today is the last day of
>> >> the month, but I'm not sure how to deal with the weekend/holiday issue
>> >> and the issue of Leap Years.
>> >>
>> >> I could use some direction as to how to attack this problem.
>> >>
>> >>
>> >> Paul Fenton
>> >

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need a way to determine the # of Saturdays in a month =?Utf-8?B?Q2h1Y2sgTQ==?= Microsoft Excel Worksheet Functions 4 5th Jul 2007 09:34 PM
Determine date based on day of month (i.e. 2nd Tuesday of the month) csb Microsoft Excel Discussion 4 9th Aug 2006 02:51 PM
Determine Last working day of Month =?Utf-8?B?TmlnZWw=?= Microsoft Excel Programming 5 25th Jul 2006 07:50 PM
How to determine what week of the month. =?Utf-8?B?R0VPUkdJQQ==?= Microsoft Access Queries 1 27th Jul 2005 03:47 PM
determine nr of days in a month Linda Microsoft Access 2 19th Apr 2004 10:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:59 AM.