Solved: Access help

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

ronyace

Thread Starter
Joined
Apr 4, 2004
Messages
50
I am trying to write a small database program to record overtime by employee. I have the following tables:
Employee Table: Employee, Salary
Overtime Entry: Employee, Hours, Reason

I created a query to determine the overtime (Hours x Salary)*1.5, which works fine.

However, if I update an employees salary for a raise, then all my overtime values calculated before the raise are recalculated with the new salary. I need the calculated values to remain how they were when calculated even after the salary is updated.

Please help.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
It is not often that you should store calculated results in a table, but this is one of them, store the overtime in your table.
The alternative is to store the date of the Rate changes and use that in the calcultions.
 

ronyace

Thread Starter
Joined
Apr 4, 2004
Messages
50
If I store the overtime in the table, won't the results just update everytime I update a persons salary ([hours x salary])=overtime.

Thanks
 

OBP

Joined
Mar 8, 2005
Messages
19,895
Not if you use Visual Basic to only update the Overtime whent he hours are first entered.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
Rony, have a look at this version, I have taken your formula and used it as Visual Basic in the After Update Event Procedure of the "Hours" field, so when you enter or edit the Hours field it puts the Overtime in the Overtime field, which I have disabled.
 

Attachments

ronyace

Thread Starter
Joined
Apr 4, 2004
Messages
50
Thanks OBP, that's exactly what I needed.
You are definitely the man, as Slurpee55 has said.

Thanks for your help. If I have any more problems you will probably see my post.
Ronyace
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top