Results 1 to 4 of 4

Thread: Overflow error

  1. #1
    Join Date
    Sep 2010
    Posts
    32

    Unanswered: Overflow error

    I am receiving an overflow error if someone could advise me on how to fix my event code I would greatly appreciate it.

    Code:
    Function sumUpdate()
    
    WOAVG = IIf([WOIssued] = 0, "", Val(Nz(WOCompleted, 0)) / Val(Nz(WOIssued, 0)))
    
    PMSAVG = IIf([PMSIssued] = 0, "", Val(Nz(PMSCompleted, 0)) / Val(Nz(PMSIssued, 0)))
    
    TOTALPERCENT = (([WOAVG] + [PMSAVG]) / 2)
    
    WOBacklog = Val(Nz(WOIssued, 0)) - Val(Nz(WOCompleted, 0))
    
    PMSBacklog = Val(Nz(PMSIssued, 0)) - Val(Nz(PMSCompleted, 0))
    
    TOTALPLANNED = Val(Nz(WOHours, 0)) + Val(Nz(PMSHours, 0)) + Val(Nz(SOCHours, 0)) + Val(Nz(PJTHours, 0))
    
    TOTALAVAIL = Val(Nz(TOTALPLANNED, 0)) + Val(Nz(DINHours, 0))
    
    End Function

  2. #2
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    Wouldn't your first two expression be possibly dividing by zero?

    C

  3. #3
    Join Date
    Sep 2010
    Posts
    32
    So I think the error lies in the iif statements so I adjusted

    to look like this

    WOAVG = IIf([WOIssued] = "0", "0", "Val(Nz(WOCompleted, 0)) / Val(Nz(WOIssued, 0))")

    PMSAVG = IIf([PMSIssued] = "0", "0", "Val(Nz(PMSCompleted, 0)) / Val(Nz(PMSIssued, 0))")

    And now I am receiving Subscript out of range error

    AHHHH Help lol

    Basically I need it so if Issued = 0 then it will put 0 in the average box and if it equals any other number I want it to divide the completed by the issued and then put that number in the average box

  4. #4
    Join Date
    Sep 2010
    Posts
    32
    Figured it out

    WOAVG = IIf([WOIssued] = 0, 0, Val(Nz([WOCompleted], 0)) / Val(Nz([WOIssued], 0)))

    PMSAVG = IIf([PMSIssued] = 0, 0, Val(Nz([PMSCompleted], 0)) / Val(Nz([PMSIssued], 0)))


    And created a calculate button instead of having each field auto calculate afterwards

Posting Permissions

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