msgbox and SQL statement

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

I am executing the statement:
CurrentDb.Execute strSQL, dbFailOnError

I was just wondering if the database fails what happens.
I need it to give at least some kind of message. How can
I at least get a message box to pop up?
 
Put error trapping in your routine.

Sub MySub()
On Error GoTo Err_MySub

....
CurrentDb.Execute strSQL, dbFailOnError
....

End_MySub:
Exit Sub

Err_MySub:
MsgBox Err.Description & " (" & Err.Number & ")"
Resume End_MySub

End Sub
 
Back
Top