Hi Guys,
I have an Onclick button that appends info to another db. On occasion, the sql doesn't work.
I was thinking of adding some sort of error handling to this to try to alert the user when it fails. It never effects the same user and its somewhat random. Out of 200, I'd say 1 or 2 do not make it to the back db.
I have never tried to use error handling and was hoping for some help. Whill this work for a failed DoCmd.RunSQL? Here is what i have so far. For space, I have taken out the "StrSQL =" part since its a very long line.
Sub Backup()
On Error Goto Error_Handle
Me.Dirty = False
DoCmd.RunSQL StrSQL
DoCmd.SetWarnings True
Error_Handle:
Msgbox "Backup has failed"
End Sub
I have an Onclick button that appends info to another db. On occasion, the sql doesn't work.
I was thinking of adding some sort of error handling to this to try to alert the user when it fails. It never effects the same user and its somewhat random. Out of 200, I'd say 1 or 2 do not make it to the back db.
I have never tried to use error handling and was hoping for some help. Whill this work for a failed DoCmd.RunSQL? Here is what i have so far. For space, I have taken out the "StrSQL =" part since its a very long line.
Sub Backup()
On Error Goto Error_Handle
Me.Dirty = False
DoCmd.RunSQL StrSQL
DoCmd.SetWarnings True
Error_Handle:
Msgbox "Backup has failed"
End Sub