The below coding was graciously provided by OnTheFly and PHV. As I open “frmList of Individuals” which has a subform “frmAppointments”, I press the cmdPrint Current Record, it prints the selected “rptAppointment Letter” using the [ApptID] field, then closes “frmList of Individuals”. This works great. This new post though involves a new/additional action.
Instead of creating an additional command button to email the selected “rptAppointment Letter”, I would like to have this new action incorporated into the coding below, if it is possible. After the selected “rptAppointment Letter” is printed (1st action) and before the “frmList of Individuals” is closed, (3rd action), I want to email the selected “rptAppointment Letter” automatically to that individual using their [EMAddress], (2nd Action).
Two issues: 1) I currently have a macro, “macEmail Appt Letter” which when activated, sends all the “rptAppointment Letter”, (Snapshot Format) to the address that I select when Microsoft Outlook opens up. I only want the selected [ApptID] record sent, not all of the records. 2) I want to have the selected “rptAppointment Letter” sent automatically using the individual’s [EMAddress] that is part of the record source “qryList of Ind Appt Dates”, before closing “frmList of Individuals”. For testing purposes I left the To blank and in the Cc I placed my office email address in the setup in the macro action “SendObject”; in the final database I need to use the Cc in the macro action “SendObject”.
Can someone provide assistance in these two requests? Thank you!
Private Sub cmdPrint_Current_Record_Click()
Dim lngApptID As Long
lngApptID = Me!ApptID
DoCmd.OpenReport "rptAppointment Letter", acViewNormal, , "ApptID=" & lngApptID
DoCmd.Close acForm, "frmList of Individuals", acSaveNo
Exit_cmdPrint_Current_Record_Click:
Exit Sub
Err_cmdPrint_Current_Record_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Current_Record_Click
End Sub
Instead of creating an additional command button to email the selected “rptAppointment Letter”, I would like to have this new action incorporated into the coding below, if it is possible. After the selected “rptAppointment Letter” is printed (1st action) and before the “frmList of Individuals” is closed, (3rd action), I want to email the selected “rptAppointment Letter” automatically to that individual using their [EMAddress], (2nd Action).
Two issues: 1) I currently have a macro, “macEmail Appt Letter” which when activated, sends all the “rptAppointment Letter”, (Snapshot Format) to the address that I select when Microsoft Outlook opens up. I only want the selected [ApptID] record sent, not all of the records. 2) I want to have the selected “rptAppointment Letter” sent automatically using the individual’s [EMAddress] that is part of the record source “qryList of Ind Appt Dates”, before closing “frmList of Individuals”. For testing purposes I left the To blank and in the Cc I placed my office email address in the setup in the macro action “SendObject”; in the final database I need to use the Cc in the macro action “SendObject”.
Can someone provide assistance in these two requests? Thank you!
Private Sub cmdPrint_Current_Record_Click()
Dim lngApptID As Long
lngApptID = Me!ApptID
DoCmd.OpenReport "rptAppointment Letter", acViewNormal, , "ApptID=" & lngApptID
DoCmd.Close acForm, "frmList of Individuals", acSaveNo
Exit_cmdPrint_Current_Record_Click:
Exit Sub
Err_cmdPrint_Current_Record_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Current_Record_Click
End Sub