Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OverFlow Error in VBA code 1

Status
Not open for further replies.

OsoRojo

Programmer
Mar 5, 2003
4
US
I am trying to trap an error in my Access app in the VBA code. At this point the on error gets me the message "overflow".The code I'm using is as follows:
Err_PrepInvoices:

MsgBox "Error: " + Error$, 0, "PrepInvoices"
Resume
What else could I use to find out what is going on?
TIA!
 
Overflow is due storing a type that is larger than that type permits, e.g.

Sub TestIntOverflow()
Dim MyInt As Integer
MyInt = 32768
End Sub

Set a breakpoint at your resume statement, and find out what LOC (line of code) it happened at, then investigate the types of all variables or fields used in that LOC.

Please don't forget to remove the Resume statement as it can cause infinite loops.
 
I have a breakpoint set at the resume line. How can I tell what line caused the error?
 
The Resume statement will resume at the line of code where the error occurred. Simply use the debugger to go to the next line of code (e.g. use the 'StepOver' Icon, or press F8).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top