Results 1 to 3 of 3
  1. #1
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287

    Update queries - calculated values based off each other..?

    Hey guys,



    Wasn't sure how to title this. I have a main table of payroll data. A user can specify an employee and a date range and click "edit." This moves appends that bit of data to secondary table (after deleting previous entries). In this secondary table, the user can change hours, commission, etc. Once they are happy with their changes they click "recalculate." This will run an update query on a bunch of other fields in the secondary table. "HourlyWages", "SalesCommission", and "TotalPay" are the ones that I am concerned with right now. Our employees get paid a base hourly wage plus their commission.

    My question:

    Can a single update query recalculate HourlyWages and SalesCommission AND use those 2 new values to calculate TotalPay?

    There are 25 fields that will actually be updated, but those three give the general idea of my question. I don't want to program all of this to have it not work.

  2. #2
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287
    Ya, doesn't work. Went the VBA route.

  3. #3
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    I wouldn't take a bet upon the ORDER in which fields would be updated, so if you are trying to update a field that will be the source of calculation for the update of a different field, then I wouldn't recommend it.

    For this kind of thing, I always use a temporary table as an intermediate step, which both avoids any ambiguity and simultaneously also avoids several kinds of syntax errors and Jet error messages.

    VBA works fine, too - although for large tables, a maketable query followed by an update query would tend to be faster.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 11-13-2013, 04:17 PM
  2. Replies: 2
    Last Post: 11-19-2012, 05:42 PM
  3. Replies: 1
    Last Post: 10-29-2012, 08:15 AM
  4. Replies: 2
    Last Post: 05-17-2012, 03:52 PM
  5. Replies: 10
    Last Post: 07-02-2011, 11:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums