msgbox and SQL statement

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?
 
D

Douglas J. Steele

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top