Custom error codes

TomJamieson

Registered User.
Local time
Today, 21:01
Joined
Jun 8, 2006
Messages
50
I have a piece of code that opens up a form and displays the record by an ID the user specifies in a text box. If the box is empty and they press the button, it errors and opens the VBA code. Obviously this is not something I want the user to see.

Firstly I tried an if statement so if the text box was empty, it would give msgbox telling the user to fill in the ID text box, but it still runs the rest of the code, even though I use the else statement. I wondered if there was a way to stop this, or if not, just a way to specify on erroring, to give a custom msgbox not go straight to the debugger?
 
Post your code so we can tell you where you're going wrong
 
You would not only need to display the msgBox but also include an Exit Sub on the next line so that the rest of the code does not execute.
 

Users who are viewing this thread

Back
Top Bottom