gojets1721
Registered User.
- Local time
- Today, 04:43
- Joined
- Jun 11, 2019
- Messages
- 430
So I am using DoCmd.SendObject on a command to open up an email with an attachment from my DB.
I want to add some new code where if the email is sent, then a field in the form updates. However, if the user exits out of the email without sending, then nothing is updated.
My code is below. Anything special that I need to do with IF statements? Or is it as simple as adding the new code under the SendObject code?
All I want to do is update the status field to 'in progress' if the email is sent (i.e. Me.Status = 'In progress')
I want to add some new code where if the email is sent, then a field in the form updates. However, if the user exits out of the email without sending, then nothing is updated.
My code is below. Anything special that I need to do with IF statements? Or is it as simple as adding the new code under the SendObject code?
All I want to do is update the status field to 'in progress' if the email is sent (i.e. Me.Status = 'In progress')
Code:
Private Sub btnSendEmail_Click()
On Error GoTo btnSendEmail_Click_Err
Dim ReportName As String
Dim Subject As String
Dim ToRecipient As String
Dim CCRecipient As String
Dim BCCRecipient As String
Dim Message As String
ReportName = "rptEmailReport"
Subject = "Notification"
ToRecipient = ""
CCRecipient = ""
BCCRecipient = ""
Message = ""
DoCmd.RunCommand acCmdRefresh
DoCmd.SendObject acReport, ReportName, acFormatPDF, ToRecipient, CCRecipient, BCCRecipient, Subject, Message, True, ""
btnSendEmail_Click_Exit:
Exit Sub
btnSendEmail_Click_Err:
MsgBox "Error #" & Err.Number & " - " & Err.Description, , "Error"
Resume btnSendEmail_Click_Exit
End Sub