Hide "Debug" Option

kbreiss

Registered User.
Local time
Today, 01:56
Joined
Oct 1, 2002
Messages
228
Hide "Debug" Option

Is there an option to turn off in the event that there is an error that the "Debug" option is not available to users?

Thanks,
Kacy
________
LovelyWendie
 
Last edited:
You need to use Error Handling within each sub and function.

i.e.


Code:
On Error Goto Err_ErrorHandler

On Error Resume Next

On Error Goto 0
 
Error Handling - it's for Excel but it's VBA so the principle is basically identical.
 
An example would be...

This example shows how if a error occured a MsgBox would pop up with a "Ok" only.
Code:
Private Sub cmdQuit_Click()
On Error GoTo Err_cmdQuit_Click

    DoCmd.Quit acQuitSaveNone

Exit_cmdQuit_Click:
    Exit Sub

Err_cmdQuit_Click:
    MsgBox Err.Description
    Resume Exit_cmdQuit_Click
End Sub

This code is the same as above, but with the MsgBox line commented so no errors will show no matter what, but it still gives you an option if you want to edit it.
Code:
Private Sub cmdQuit_Click()
On Error GoTo Err_cmdQuit_Click

    DoCmd.Quit acQuitSaveNone

Exit_cmdQuit_Click:
    Exit Sub

Err_cmdQuit_Click:
    'MsgBox Err.Description
    Resume Exit_cmdQuit_Click
End Sub
________
Roor bongs
 
Last edited:
Or to clear the error...
Code:
Private Sub cmdQuit_Click()
On Error GoTo Err_cmdQuit_Click

    DoCmd.Quit acQuitSaveNone

Exit_cmdQuit_Click:
    Exit Sub

Err_cmdQuit_Click:
    Err.Clear
    Resume Exit_cmdQuit_Click
End Sub
 

Users who are viewing this thread

Back
Top Bottom