1) Does the database get opened every day of the month?
2) Do you want the code to only run once on the last day or does it have to
run multiple times?
I will assume
++ that the database is not running continuously
++ you only want to run KPICalStep1 once per period
++ that the database may not always be opened on the last day of the month
when the last day of the month falls on a weekend or Holiday.
I would create a table with a field to record the next execution day.
When the database opens (assuming you have some form that always opens) use
the form's On load event to check to see if the current date is greater than
the next execution date.
If so, run your code and as part of the code set the next execution date to
the next end of the month.
Something like this would set the date for the end of the following month.
ExecutionDate = DateSerial(Year(ExecutionDate),Month(ExecutionDate)+1,0)
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County