by Steve Scha » Sat, 22 Oct 2005 03:45:17
Ann,
If I understand you correctly, you want this macro to run the first time
the database is opened in any given calendar year.
First of all, make a simple table with one field, Date/Time data type.
This will just have one record which is the date of the last carryover
vacation update. Let's call the table VacsUpdated and the field UpdateDate.
Then make a macro, which you will assign on some appropriate event in
your database... often this is the On Open event property of a form that
is opened whenever the database application is opened. In the Condition
of this macro (if you can't see a Condition column in the macro design
window, select it from the View menu), you can put the equivalent of this...
DLookup("Year([UpdateDate])","VacsUpdated")<Year(Date())
Add the actions to the macro to process your vacation time update, it
sounds like you already have that sorted. In the Condition of each
action after the first, put:
...
which will cause the Condition to apply to all actions in the macro.
Then, at the end of the macro you will need to use an OpenQuery action
or a RunSQL action, to run an Update Query to reset the UpdateDate in
the VacsUpdated table to the current date, and then that's that taken
care of for another year.
--
Steve Schapel, Microsoft Access MVP