How do I handle an error that gives a "type mismatch" when
the text boxes are empty?
Thanks everybody
Printable View
How do I handle an error that gives a "type mismatch" when
the text boxes are empty?
Thanks everybody
In what context are you getting the error. Provide some code.
Put this line at the very top of all the code.
On Error Resume Next
This line ignores all errors and just stops the code.
I don't agree matthew, it does not stop the code, it just resumes to the next line, check out this small code.Quote:
By Matthew Gates:
On Error Resume Next
This line ignores all errors and just stops the code.
It'll just display the msgbox :)Code:Private Sub Form_Load()
On Error Resume Next
Err.Raise 23
MsgBox "test"
End Sub
In case you want to actually Exit the Sub:
I know you already knew all this Matthew, but just to tell the people who didn't :)Code:Private Sub Form_Load()
On Error GoTo ErrH
Err.Raise 23
MsgBox "test"
Exit Sub 'In case no errors occur
ErrH:
Exit Sub 'an error occured, exit the sub.
End Sub
Perhaps, a misunderstanding Jop?
What I meant was that it stops the error a.k.a ignores it and continues on.
Sorry I didn't explain myself :rolleyes:.
By the way, a little late, but...
Happy Birthday~! :D
No problem Matt...
and hey, better late then never :)
thanks!