Blocking display of VBA codes (1 Viewer)

gear

Registered User.
Local time
Today, 01:15
Joined
Mar 10, 2007
Messages
112
I am asking this out of curiosity. Is there a way to block the appearance of Visual Basic Editor? Whenever there is some mismatch or error in the operation of Access DB, the VB Editor displays the codes with ‘End’, ‘Debug’ & ‘Cancel’ options. What I feel is that inexperienced users may fiddle with the codes which will in turn corrupt the DB. In order to prevent that, can we do something to prevent the VB codes being displayed?
 

boblarson

Smeghead
Local time
Today, 01:15
Joined
Jan 12, 2001
Messages
32,059
You put in an error handler into your events. For example:
Code:
On Error GoTo err_handler

<<<The event code goes here>>>

Exit Sub

err_handler:
   MsgBox Err.Description, vbExclamation, "Error Number: " & Err.Number
   Resume Next
End Sub
 

gear

Registered User.
Local time
Today, 01:15
Joined
Mar 10, 2007
Messages
112
Dear Bob
You mean I need to put this error handler for each event?
 

boblarson

Smeghead
Local time
Today, 01:15
Joined
Jan 12, 2001
Messages
32,059
Yep, each event that could have a runtime error, you would want to do that. For an easy way to add them, look into downloading MZ-Tools for VBA (http://www.mztools.com) as you can configure a standard error handler and then just put your cursor in the event and click the button and it will add it for you.
 

Users who are viewing this thread

Top Bottom