1. ## Overflow Error (2002)

I have an after update event that is supposed to calculate the annual salary by multiplying the contract salary by the FTE (full-time equivalent). If a person is full time 1.000 then there is no problem but sometimes when the FTE is less than full time then the calculation gives a "runtime error '6' Overflow" message. For example the contract salary is \$67,815 and the FTE is .50, I get the error. From what I read, the overflow message would mean the answer would be too large but in this case the answer should be half the size of the contract salary. How can I trap for this error and is there something I could do to prevent it?

2. ## Re: Overflow Error (2002)

What data types are you using in the calculation, Judy? You'll also get an overflow error if your datatype won't hold the result of the calculation. If you post the code for the calculation, we might be able to spot the problem.

3. ## Re: Overflow Error (2002)

This error can occur when the numbers are too large for the variables you are using for the calculations.

For example if you have declared a variables as an integer, when it needs to be a long integer, it will work OK if the numbers are small, but give overflow if the numbers get too large.

Can you post the code you are using in the event.

4. ## Re: Overflow Error (2002)

Private Sub Combo50_AfterUpdate()
Dim TFTE As Single
Dim PTSal As Integer
Dim PTSal5 As Integer
Dim PTPerDiem As Single
TFTE = Me.TotalFTE

Me.Step = Me.Combo50.Column(2)
Me.GradeStep1 = Me.Combo50.Column(1) & "/" & Me.Combo50.Column(2)
Me.ContractSalary = Me.Combo50.Column(3)
Me.PerDiem = Me.Combo50.Column(4)

If TFTE < 1 Then
PTSal = Me.ContractSalary * TFTE
PTSal5 = PTSal * 1.05
Me.ContractSalary = PTSal5
PTPerDiem = PTSal5 / NoDays
Me.PerDiem = PTPerDiem
Me.ActualSalary.Requery
End If
End Sub

5. ## Re: Overflow Error (2002)

You have declared PTSal and PTSal5 as Integers, i.e. whole numbers in the range -32768 to +32767. You should declare them as Single, Double or Currency (and use the same type for TFTE and PTPerDiem)

6. ## Re: Overflow Error (2002)

Thank you all very much. Just changing the variables from integer to single did the trick. I wanted whole numbers without decimals that is why I used integer. But now I understand that Access could not even complete the calculation because I had used integer. The records where it had worked apparently did not need to carry the answer out to where it needed to use decimal places.

#### Posting Permissions

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