J
JK
Currently, in my database, I'm able to use a command button to send a report
in SNP format. I'm trying to find some help convert this code (posted below)
so that it generates a report & attaches it to an email in PDF format -
again, not SNP. I'm hope a few simple changes will do the trick... Thx!!!!
Private Sub cmdMailFinishedWorkorderReport_Click()
'**********************
'Developed by Mike Buraczewski
Dim MailList As String
Dim strCCTo As String
Dim strBccTo As String
Dim strmsg As String
Dim Address As Variant
'Report variables
Dim strFilter As String
Dim rpt As String
'Create string for list of mail recipients
'lstMailer is a multiselect listbox
For Each Address In Me.lstMailer.ItemsSelected
MailList = MailList & ";" & """" & Me.lstMailer.ItemData(Address) & """"
Next Address
If MailList = "" Then
MailList = ""
Else
MailList = Right(MailList, Len(MailList) - 1)
End If
'**********************
'set report to print
rpt = "Finished Workorders Past Week" 'report name goes here. This is the
name of the report you wish to send.
strFilter = "" 'add code to create filter for report if necessary
strCCTo = "" 'Additional email addreses go here
strBccTo = "" 'Additional blind email addrresses go here
strmsg = "" 'Default message content goes here
DoCmd.OpenReport rpt, acPreview, , strFilter
'The next line sends the report in RTF format.
'This can be changed to several formats, search the help file for acFormatRTF
DoCmd.SendObject acSendReport, rpt, acFormatSNP, MailList, strCCTo,
strBccTo, "Finished Workorders", strmsg, -1
DoCmd.Close
MsgBox "This form is incomplete." & vbNewLine & vbNewLine & "Modify the code
per the in-line comments", , "Send E-Mail"
Exit_cmdPrint_Click:
Exit Sub
Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click
End Sub
in SNP format. I'm trying to find some help convert this code (posted below)
so that it generates a report & attaches it to an email in PDF format -
again, not SNP. I'm hope a few simple changes will do the trick... Thx!!!!
Private Sub cmdMailFinishedWorkorderReport_Click()
'**********************
'Developed by Mike Buraczewski
Dim MailList As String
Dim strCCTo As String
Dim strBccTo As String
Dim strmsg As String
Dim Address As Variant
'Report variables
Dim strFilter As String
Dim rpt As String
'Create string for list of mail recipients
'lstMailer is a multiselect listbox
For Each Address In Me.lstMailer.ItemsSelected
MailList = MailList & ";" & """" & Me.lstMailer.ItemData(Address) & """"
Next Address
If MailList = "" Then
MailList = ""
Else
MailList = Right(MailList, Len(MailList) - 1)
End If
'**********************
'set report to print
rpt = "Finished Workorders Past Week" 'report name goes here. This is the
name of the report you wish to send.
strFilter = "" 'add code to create filter for report if necessary
strCCTo = "" 'Additional email addreses go here
strBccTo = "" 'Additional blind email addrresses go here
strmsg = "" 'Default message content goes here
DoCmd.OpenReport rpt, acPreview, , strFilter
'The next line sends the report in RTF format.
'This can be changed to several formats, search the help file for acFormatRTF
DoCmd.SendObject acSendReport, rpt, acFormatSNP, MailList, strCCTo,
strBccTo, "Finished Workorders", strmsg, -1
DoCmd.Close
MsgBox "This form is incomplete." & vbNewLine & vbNewLine & "Modify the code
per the in-line comments", , "Send E-Mail"
Exit_cmdPrint_Click:
Exit Sub
Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click
End Sub