Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2012
    Posts
    8

    Unanswered: Calculated Field Not Calculating

    i am trying to make what should be a very simple calculated expression in my EMPLOYEE INFORMATION table:

    [HRS WEEKLY]+[HRS_2]+[HRS_3]+[HRS_4]

    However, it comes back as empty. If i only do the first 2 fields [HRS WEEKLY]+[HRS_2] to calculate, i do get some results back, but any filed in HRS_2 that is null, leaves the calculation as null.

    it should not be this difficult for Access to calculate the total number of hours for all 4 data fields, so that I can have one auto calculated result field. I desperately need this as some of my employees don't seem to accurately calculate the numbers to enter them into the Total HPW field.

    CAN ANYONE HELP? WHAT AM I MISSING?

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    I would have expected Access to handle that, but what you may need to do is use the NZ function

    Code:
    = nz([HRS WEEKLY],0) + nz([HRS_2],0) + nz([HRS_3],0) + nz([HRS_4],0)
    Last edited by healdem; 06-15-12 at 04:09. Reason: forgot toput the terminating /code tag
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Apr 2012
    Posts
    8

    Thanks, tried but didn't work

    I ENTERED THE FOLLOWING INTO THE EXPRESSION BUILDER:

    Nz([HRS_WEEKLY],0]+Nz([HRS_2],0)+Nz([HRS_3],0)+Nz([HRS_4],0)

    AND THIS IS THE MESSAGE THAT I GOT BACK:

    THE EXPRESSION Nz([HRS_WEEKLY],0]+Nz([HRS_2],0)+Nz([HRS_3],0)+Nz([HRS_4],0) CANNOT BE USED IN A CALCULATED COLUMN

    ANY OTHER IDEAS?

  4. #4
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Lemme guess. You're doing this in the table, right? You're setting the value of the field (whatever name it is) to equal the sum of 4 other fields? IF I read you right, all you're missing now is an equals sign "=" in the beginning of the calculation, as in
    Code:
    = Nz([HRS_WEEKLY],0]+Nz([HRS_2],0)+Nz([HRS_3],0)+Nz([HRS_4],0)
    If this is not the case, would you please give us a hint what you're doing with this calculation?

    Thanks,
    Sam

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •