Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Debug Error when email cancelled

Status
Not open for further replies.

Drenda

Programmer
Sep 1, 2007
85
GB
Can anyone help

I have a command button that carries out a send object (Email with attachement when clicked. However if the user cancels the email I get a debug error. On other buttons in my databse I get the accepted send action cancelled

Can you advise what I need to correct so I get the send action cancelled msgbox

Here is the code. the debug directs me to the send object line

Private Sub Email_Notification_of_Cost_Change_Click()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me.[EMAIL COST AUTHORISATION FOR MANAGERS APPROVAL].SetFocus
Forms![Cost Authorisation Non - Project Form]![Email Notification of Cost Change].Enabled = False
DoCmd.SendObject acSendReport, "Cost Authorisation Variation", acFormatSNP, , , , "Cost Variation for " & [PREFIX] & [ID] & " Costs have changed from £" & [Actual Cost] & " TO " & "£" & [Total Cost], "Cost Variation for " & [PREFIX] & [ID] & " Costs have changed from £" & [Actual Cost] & " TO " & "£" & [Total Cost] & " - Please see attached for detail of the cost authorisation", , False

Exit_Email_Notification_of_Cost_Change_Click:
Exit Sub


Err_Email_Notification_of_Cost_Change_Click:
MsgBox Err.Description
Resume Exit_Email_Notification_of_Cost_Change_Click

End Sub

Many thanks in anticipation of your help
 
Seems you missed this instruction:
On Error GoTo Err_Email_Notification_of_Cost_Change_Click

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Apologies

but I am having a very long period of stupidity - can you tell me where to place the goto instruction as I can't seem to make it work
 
Just managed to make it work - many thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top