I would recommend looking at the algorithm you used first. There seems to
be a few problems in your algorithm if my understanding is correct. In
fact, these problems make it harder for you to construct the Update Query
correctly. For examples:
1. Let's say if you run the update today 25/Jan/2004. With the Update Query
you are constructing, you are forced to run the Update Query again exactly
on the 26/Feb/2004! If you run it too early,then some employees may get
the credit *twice*. If you run it too late, some employees will miss out
the annual vacation credit for the year. Clearly, you cannot rely on the
Query being run on the exact day month after month since the required dates
may be weekend or the person who is supposed to run it may be away on the
dates.
Clearly, you cannot afford the hit & miss like this. You need to devise an
algorithm that make sure the employees get vacation credit exactly *once* a
year with some flexibility when the Update Query will be run. You may even
need to modify the Table Structure to achieve this.
2. Your algorithm doesn't seen to cater for the case where the employee
still has some credit from the previous year and the current year's credit
is due.
3. You will also need to be very clear about the selection criteria to
cater for point 1 about.
4. Note that the age calculation in the link I posted uses *today* as the
reference point. In your case, you need whole years of service with the
*coming anniversary of hire date* as the reference point and these 2 may be
different.
Suggest you think carefully how the algorithm should work and do trial runs
with different anniversary dates on paper and see if your algorithm works
correct from month to month with early / late processing and different
anniversary dates. Try with border-line cases to ensure *everything* is
covered. If fact, if you enumerate the border-line cases, it will help you
to think clearly.
Only after you think, devise & test your algorithm thoroughly like this, you
should then try to construct the Update Query and codes if required. You
may even need more than one Query.
You probably will need to use DateSerial and other DateTime functions but
this is implementation to be done *after* you devising the correct algorithm
for your requirements / set-up.
--
HTH
Van T. Dinh
MVP (Access)
AngiW said:
Van,
First, i would like to apologize if i seemed abrupt in that last posting. I'm
extremely frustrated!! Second, that link you sent me works great!!! It solved
the exactly a year problem. Now, there's still the other problem...making sure
it doesn't update the VacAvail field more than a month after the anniversary
date. I thought about doing something along the lines of WHERE date() - [hire
date] <30...but 30 won't work because not all months are 30 days...so am I back
to the dateserial??? Thanks everyone for all your help!!! I REALLY appreciate
it!