Hello
Can anyone help
I have a command button click event for sending an email
If the user decides to cancel the email the following msgbox appears saying
"Run-Time Error 2501"
"The SendObject Action was cancelled"
END or Debug
I would like to prevent this from happening but not sure how to
I have posted my code below as I thought it may help
Private Sub Cost_Authorisation_Queries_Click()
On Error GoTo Err_Cost_Authorisation_Queries_Click
Dim stDocName As String
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
If [Forms]![Cost Authorisation Non - Project Form]![Vendor Authorisation] = "Query" Then DoCmd.SendObject acSendReport, "Vendor Comments_Query Report", acFormatSNP, , , , "Vendor Query Raised for " & [PREFIX] & [ID], "Vendor Query Raised for " & [PREFIX] & [ID] & [vbCrLf] & [vbCrLf] & "Please see comments below which are also shown on the attached document" & [vbCrLf] & [vbCrLf] & [Comments], , False
If [Forms]![Cost Authorisation Non - Project Form]![ML Authorisation 1] = "Query" Then DoCmd.SendObject acSendReport, "ML Authorisation1 Comments_Query Report", acFormatSNP, , , , "ML Query Raised for " & [PREFIX] & [ID], "ML Query Raised for " & [PREFIX] & [ID] & [vbCrLf] & [vbCrLf] & "Please see comments below which are also shown on the attached document" & [vbCrLf] & [vbCrLf] & [Comments], , False
If [Forms]![Cost Authorisation Non - Project Form]![ML Authorisation 2] = "Query" Then DoCmd.SendObject acSendReport, "ML Authorisation 2 Comments_Query Report", acFormatSNP, , , , "ML Query Raised for " & [PREFIX] & [ID], "ML Query Raised for " & [PREFIX] & [ID] & [vbCrLf] & [vbCrLf] & "Please see comments below which are also shown on the attached document" & [vbCrLf] & [vbCrLf] & [Comments], , False
Exit_Cost_Authorisation_Queries_Click:
Exit Sub
Err_Cost_Authorisation_Queries_Click:
MsgBox Err.Description
Resume Exit_Cost_Authorisation_Queries_Click
End Sub
Can anyone help
I have a command button click event for sending an email
If the user decides to cancel the email the following msgbox appears saying
"Run-Time Error 2501"
"The SendObject Action was cancelled"
END or Debug
I would like to prevent this from happening but not sure how to
I have posted my code below as I thought it may help
Private Sub Cost_Authorisation_Queries_Click()
On Error GoTo Err_Cost_Authorisation_Queries_Click
Dim stDocName As String
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
If [Forms]![Cost Authorisation Non - Project Form]![Vendor Authorisation] = "Query" Then DoCmd.SendObject acSendReport, "Vendor Comments_Query Report", acFormatSNP, , , , "Vendor Query Raised for " & [PREFIX] & [ID], "Vendor Query Raised for " & [PREFIX] & [ID] & [vbCrLf] & [vbCrLf] & "Please see comments below which are also shown on the attached document" & [vbCrLf] & [vbCrLf] & [Comments], , False
If [Forms]![Cost Authorisation Non - Project Form]![ML Authorisation 1] = "Query" Then DoCmd.SendObject acSendReport, "ML Authorisation1 Comments_Query Report", acFormatSNP, , , , "ML Query Raised for " & [PREFIX] & [ID], "ML Query Raised for " & [PREFIX] & [ID] & [vbCrLf] & [vbCrLf] & "Please see comments below which are also shown on the attached document" & [vbCrLf] & [vbCrLf] & [Comments], , False
If [Forms]![Cost Authorisation Non - Project Form]![ML Authorisation 2] = "Query" Then DoCmd.SendObject acSendReport, "ML Authorisation 2 Comments_Query Report", acFormatSNP, , , , "ML Query Raised for " & [PREFIX] & [ID], "ML Query Raised for " & [PREFIX] & [ID] & [vbCrLf] & [vbCrLf] & "Please see comments below which are also shown on the attached document" & [vbCrLf] & [vbCrLf] & [Comments], , False
Exit_Cost_Authorisation_Queries_Click:
Exit Sub
Err_Cost_Authorisation_Queries_Click:
MsgBox Err.Description
Resume Exit_Cost_Authorisation_Queries_Click
End Sub