Use the VB error handler to capture the error or ignore it.
Example: Capture the error and handle it in code
Sub SendMail()
On Error GoTo SendMailErr
DoCmd.SendObject acSendQuery, "qTest", , "emailaddr", , , "Test", "Another test."
Exit Sub
SendMailErr:
If Err = 2501 Then
Exit Sub
End If
' Additional error handling code here
Resume next
End Sub
Example: Ignore all errors
Sub SendMail()
On Error Resume Next
DoCmd.SendObject acSendQuery, "qTest", , "emailaddr", , , "Test", "Another test."
End Sub Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.