Trap for error 2501 in the error-handler. Here is an example I use all the
time if a report includes no data (my reports include a nodata event
procedure, which cancles opening the report, which generates the same error
2501):
Private Sub cmdPreviewOrders_Click()
On Error GoTo ProcError
DoCmd.OpenReport "rptOrders", acPreview, _
WhereCondition:="OrderID = " & Me.OrderID
ExitProc:
Exit Sub
ProcError:
Select Case Err.Number
Case 2501 'No Data
Case Else
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in cmdPreviewOrders_Click event
procedure..."
End Select
Resume ExitProc
End Sub
Tom
http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
"Johnplat" wrote:
I added a button to call outlook express with docmd.sendobject. It works just
fine if I sendf a message. If I just close outlook express without any
message, I get an error 2501 Send Object action was cancelled. How can I
eliminate this message, if I don't send a message in outlook express?