Error handling (1 Viewer)

ryetee

Registered User.
Local time
Today, 02:28
Joined
Jul 30, 2013
Messages
952
OK I could blame this on inheriting a database with missing error handling but it's all my fault! I got carried away with getting the code complete that I've missed quite a few modules without any error handling

So basically I need to add a number of lines to each module. 1 at the top and several down the bottom,

top....
On Error GoTo Err_Handler
with something like the following at the bottom
Err_Handler:
Select Case Err.Number
Case 2474
Resume Next
Case 2185 'Text box loses focus when no characters left.
Resume Exit_Handler
Case 2074
MsgBox "You have made changes to the form. To use the filter please close and reopen without making changes"
Resume Exit_Handler
Case Else
MsgBox "Error " & Err.Number & ": " & Err.Description, vbExclamation, "txtFindAsUTypeValue_Change"
Resume Exit_Handler
End Select


This is obviously going to be a pain in the you know where.
For the time being can I get away with putting one line in such as

on error msgbox "something "
exit sub

or call some function that returns something that tells the code what to do!! i.e. exit sub, resume next etc etc
 

isladogs

MVP / VIP
Local time
Today, 02:28
Joined
Jan 14, 2017
Messages
18,246
Sorry to tell you this but you're just going to have to do it properly.

It won't take quite as long as you'd expect but to save yourself a lot of time, I suggest you purchase MZ Tools as this includes a feature to add error handling to each code module. The time saved should be well worth the money spent ... and it has numerous other useful features
 

Users who are viewing this thread

Top Bottom