1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Access help

Discussion in 'Business Applications' started by ronyace, Nov 5, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. ronyace

    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.
     
  2. OBP

    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.
     
  3. ronyace

    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
     
  4. OBP

    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.
     
  5. ronyace

    ronyace Thread Starter

    Joined:
    Apr 4, 2004
    Messages:
    50
    How would that code look. If you don't mind my asking.

    Thanks
     
  6. slurpee55

    slurpee55

    Joined:
    Oct 20, 2004
    Messages:
    7,837
    ronyace, you are asking the man! LOL
     
  7. ronyace

    ronyace Thread Starter

    Joined:
    Apr 4, 2004
    Messages:
    50
    I am attaching my file in case you need to take a look.

    Thanks,
    Ronyace
     

    Attached Files:

  8. OBP

    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.
     

    Attached Files:

  9. ronyace

    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
     
  10. Sponsor

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 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/648170

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice