DoCmd.SendObject acSendReport, stDocName, acFormatPDF, "", , , "Emailing" & " " & strFileName
'Close the Report
DoCmd.Close acReport, stDocName
Exit_cmdX_Single_Click:
Exit Sub
Cancel_cmdX_Single_Click:
Exit Sub
Cancel = True
Err_cmdX_Single_Click:
DoCmd.Close acReport, stDocName
Exit Sub
Cancel = True
DoCmd.CancelEvent
MsgBox Err.Description
Select Case Err.Number
Case 2501
This triggers but I still get the "The SendObject action was cancelled" message and subsequent application FAIL
End Select
Resume Exit_cmdX_Click
End Sub
Scenario:
1) User closes the email without sending.
2) They get the "The SendObject action was cancelled" message
3) Then the Access application is locked and cannot be closed "You can't exit Microsoft Access now. If you're running a Visual Basic module that is using OLD or DDE, you may need to interrupt the module.
4) User is forced to shut down MSACCESS.exe via Task Manager
The cancel event was added as an attempt to stop this from happening all to no avail. Tried various methods; turning off the error description, exiting the sub etc... None trigger in the ACCDE.
In the ACCDE, if they use the X button to close the message without sending the email, the "The SendObject action was cancelled" message appears and insert FAIL function
Windows 7 32 & 64 bit : Office Pro Plus 2010 32 bit (mix of 14.0.6029 & 14.0.7015) (tested on multiple PCs, all behaving the same way): ACCDE database
This was marked as solved on the "sendobject on cancel error" however I'm not entirely sure why or how...