There are many factors that would influence the choice of the best approach
for this.
Firstly, you will need a table with the values to look up, e.g.:
MinYears MinutesPerPayPeriod
0 150
5 222
10 282
(I'm suggesting you store this as minutes to facilite date/time calculations
and avoid rounding errors.)
Presumably your Employee table has a DateOfHire field. You can therefore
calculate the number of years of service, and get the Minutes for that
number of years. The calculation of number of years will be similar to this
calculation of years:
http://allenbrowne.com/func-08.html
You may also need this info to create a query that gives you the MaxYears as
well:
http://allenbrowne.com/ser-58.html
And to get the number of hours into your main query, you will need a
subquery:
http://allenbrowne.com/subquery-01.html
or a DLookup() expression:
http://allenbrowne.com/casu-07.html
Now to put those techniques to good use. Presumably you have a table where
you record the number of hours per employee per pay period, and the pay
rate. So you could add another field to that table to store the number of
hours accrued, and have this calculated and stored as part of that record.
It's not clear here how you handle part timers, e.g. whether their a person
who works half time gets half the number of hours per period.
You will also need to provide a way to record when an employee takes leave,
so you can subtract the number of hours actually taken from the number of
hours due.
There will also be other complicating factors, such as sick leave or
compassion leave which may also need to be stored and accumulated, and
possibly lost after a period if not used without losing the accumulated
holiday leave, provision for long service leave, and handling cases where
accumulated leave may be cancelled (e.g. if the employee is found guilty of
fraud.)
You may need to check out what laws apply where you live, but don't forget
that these laws may change over the years, so you may find there are some
laws applying to leave accumulated before a certain date, and other laws
after that time.
So, there's plenty to think about.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
"open a adobe file from a command button"