Jeff said:
Have you checked at mvps.org/access or using Google? There may already be
a routine written to do this.
Conceptually, it seems like you are looking for the last weekday of the
month previous to the current month. But that depends, how are you defining
"business day"?
Rather than a 'routine', I would recommend the OP use calendar table, a
standard SQL trick, with all the dates within the required range (a
decade, say) with a column to indicate whether it is or is not a
business day for the given enterprise.
This is related to the fallacy that you should never store something
that can be calculated e.g. the day of the week. When the rule is
'weekends are not business days' the calculation is simple. You only
need to add a further rule such as 'public holidays are not business
days' and the calculation is a bit costlier e.g. what are the public
holidays, moveable feasts, region-specific holidays, company-specific
events, etc. It could be that storing 'calculations' such as weekday,
week_number, is_business_day, first_day_this_month, etc for every day
in the decade is technically redundant but if it makes SQL queries
easier to write (and available to the enterprise beyond Access users
because it avoids embedded VBA) then it is certainly worth considering.
Jamie.
--