I have found TheScripts a very useful site, but however I cannot find an answer to a problem I am having, so I finally have to ask the question!
I am getting an Overflow error in a Function I have written.
BUT... It does not occur all the time.
If I call the Function from the "After Update" event for a checkbox, it works as intended, how ever if I call the Function from the "On Load" event of the Form, testing to see whether the checkbox's value is True I get the Overflow Error.
To confirm this, I set a break point below where I was getting the error. If called via the "After Update" event, the variable has the right value, but if it is called from the "On Load" event that variable holds 0.
This is the code snippet that is causing the problem:
Dim adjustHours As Integer
Dim averagePay As Currency
If Me.projectAllocatedHours.Enabled = True Then
adjustHours = Me.projectAllocatedHours - Me.projectTotalHours
averagePay = Me.tempAveragePay
' The above line is the one causing grief
...
End If
From what I have read, the definition of an overflow error is "Overflow means the number is too large for the data type."
as this works one way, and not the other it has me stumped.
Thanks in advance for your help.
Zane