Johnny Drama
In need of beer...
- Local time
- Today, 03:06
- Joined
- Dec 12, 2008
- Messages
- 211
Okay,
I have an interesting one and I'm not sure if what I'm trying to do is possible.
I have a form (frmUpdate Ctrl) that allows users to update data as needed. On that form is a button that passes the record number to a report, opens the report with the single record, and then emails the updated record to the appropriate person.
I'm trying to make it so that the preview of the report does not open, but just attaches the report to the email. Is this possible, or does the report need to be open to accept the passing of the record value?
The VBA code is below.
Private Sub btn_mailreport_Click()
On Error GoTo Err_btn_mailreport_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "rptUpdated Control"
stLinkCriteria = "[Control Number]=" & "'" & Me![Control Number Combo] & "'"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
DoCmd.SendObject acReport, stDocName, acFormatRTF, "email@domain.com", , , "Updated Control", "The attached control has been updated", True
Exit_btn_mailreport_Click:
Exit Sub
Err_btn_mailreport_Click:
MsgBox Err.Description
Resume Exit_btn_mailreport_Click
End Sub
Thanks in advance for any help.
I have an interesting one and I'm not sure if what I'm trying to do is possible.
I have a form (frmUpdate Ctrl) that allows users to update data as needed. On that form is a button that passes the record number to a report, opens the report with the single record, and then emails the updated record to the appropriate person.
I'm trying to make it so that the preview of the report does not open, but just attaches the report to the email. Is this possible, or does the report need to be open to accept the passing of the record value?
The VBA code is below.
Private Sub btn_mailreport_Click()
On Error GoTo Err_btn_mailreport_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "rptUpdated Control"
stLinkCriteria = "[Control Number]=" & "'" & Me![Control Number Combo] & "'"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
DoCmd.SendObject acReport, stDocName, acFormatRTF, "email@domain.com", , , "Updated Control", "The attached control has been updated", True
Exit_btn_mailreport_Click:
Exit Sub
Err_btn_mailreport_Click:
MsgBox Err.Description
Resume Exit_btn_mailreport_Click
End Sub
Thanks in advance for any help.