My users produce three different serialized numbered reports and email them. Variables are passed down to the sub procedure listed below which exports the report based on the format they select and attaches the report to the email. The varible 'docname' is the report to open and the 'RefCtl' is the serialized number of the report to be emailed.
They want me to include 'RefCtl' in attachment name. So instead of the attachement being named 'rptCARLetter' the name would be like "CAR-TLE-06-0001".
Thanks for any help you can give me.
Dim RefCtl As String, RefSupp As String, docname As String
Dim stOutputFile
stOutputFile = MFilename ' Drive and Path first
'MsgBox "Mail"
Select Case MReport
Case Is = "Print CAR Record"
docname = "rptCARLetter"
RefCtl = MRptID
'Opens the correct Report for viewing
'MsgBox "openreport"
DoCmd.OpenReport docname, acViewPreview, , "[DCN] = '" & RefCtl & "'"
'MsgBox "next"
Case Is = "Print CIO Record"
docname = "rptCIOLetter"
RefCtl = MRptID
'Opens the correct Report for viewing
DoCmd.OpenReport docname, acViewPreview, , "[DCN] = '" & RefCtl & "'"
Case Is = "Print PQDR Record"
docname = "rptPQDRLetter"
RefCtl = MRptID
'Opens the correct Report for viewing
'MsgBox "openreport"
DoCmd.OpenReport docname, acViewPreview, , "[DCMAID] = '" & RefCtl & "'"
'MsgBox "next"
End Select
Select Case MFormat
Case "HTML"
stOutputFile = stOutputFile & "HTML"
DoCmd.OutputTo acOutputReport, docname, acFormatHTML, stOutputFile
DoCmd.SendObject acSendReport, docname, acFormatHTML, , , , "Status Report", "The attached Status Reported was generated by the QDP Application"
Case "RTF"
stOutputFile = stOutputFile & "rtf"
DoCmd.OutputTo acOutputReport, docname, acFormatRTF, stOutputFile
DoCmd.SendObject acSendReport, docname, acFormatRTF, , , , "Status Report", "The attached Status Reported was generated by the QDP Application"
Case "TXT"
stOutputFile = stOutputFile & "txt"
DoCmd.OutputTo acOutputReport, docname, acFormatTXT, stOutputFile
DoCmd.SendObject acSendReport, docname, acFormatTXT, , , , "Status Report", "The attached Status Reported was generated by the QDP Application"
End Select
They want me to include 'RefCtl' in attachment name. So instead of the attachement being named 'rptCARLetter' the name would be like "CAR-TLE-06-0001".
Thanks for any help you can give me.
Dim RefCtl As String, RefSupp As String, docname As String
Dim stOutputFile
stOutputFile = MFilename ' Drive and Path first
'MsgBox "Mail"
Select Case MReport
Case Is = "Print CAR Record"
docname = "rptCARLetter"
RefCtl = MRptID
'Opens the correct Report for viewing
'MsgBox "openreport"
DoCmd.OpenReport docname, acViewPreview, , "[DCN] = '" & RefCtl & "'"
'MsgBox "next"
Case Is = "Print CIO Record"
docname = "rptCIOLetter"
RefCtl = MRptID
'Opens the correct Report for viewing
DoCmd.OpenReport docname, acViewPreview, , "[DCN] = '" & RefCtl & "'"
Case Is = "Print PQDR Record"
docname = "rptPQDRLetter"
RefCtl = MRptID
'Opens the correct Report for viewing
'MsgBox "openreport"
DoCmd.OpenReport docname, acViewPreview, , "[DCMAID] = '" & RefCtl & "'"
'MsgBox "next"
End Select
Select Case MFormat
Case "HTML"
stOutputFile = stOutputFile & "HTML"
DoCmd.OutputTo acOutputReport, docname, acFormatHTML, stOutputFile
DoCmd.SendObject acSendReport, docname, acFormatHTML, , , , "Status Report", "The attached Status Reported was generated by the QDP Application"
Case "RTF"
stOutputFile = stOutputFile & "rtf"
DoCmd.OutputTo acOutputReport, docname, acFormatRTF, stOutputFile
DoCmd.SendObject acSendReport, docname, acFormatRTF, , , , "Status Report", "The attached Status Reported was generated by the QDP Application"
Case "TXT"
stOutputFile = stOutputFile & "txt"
DoCmd.OutputTo acOutputReport, docname, acFormatTXT, stOutputFile
DoCmd.SendObject acSendReport, docname, acFormatTXT, , , , "Status Report", "The attached Status Reported was generated by the QDP Application"
End Select