Access_Help
Registered User.
- Local time
- Today, 12:01
- Joined
- Feb 12, 2005
- Messages
- 136
Hi,
I have a fully working script for attaching a report to an e-mail. I want to extend the script to attach another report. not sure how I can add a second sql script and attach the second report to the e-mail...
I have a fully working script for attaching a report to an e-mail. I want to extend the script to attach another report. not sure how I can add a second sql script and attach the second report to the e-mail...
Code:
Public Sub Command6_Click()
Dim vTo, vCC, vSubj, vBody, vRpt, vForm, vHoy
Dim vFilePath
Dim i As Integer
vRpt = "Report"
vQry = "qry_difference_achievement"
'scan the list box
For i = 0 To lstEAddrs.ListCount - 1
vItm = lstEAddrs.ItemData(i) 'get new item
lstEAddrs = vItm 'set list box to item
DoCmd.OpenReport vRpt, acPreview, , "[Form]= '" & lstEAddrs.Column(0) & "'"
vName = lstEAddrs.Column(1)
vForm = lstEAddrs.Column(0)
vHoy = lstEAddrs.Column(4)
vSubj = "XYZ: " & vForm & ""
vTo = lstEAddrs.Column(2) 'col 1 has ID, col2 has email (in vb, combo box items starts with 0)
vCC = "xyz@gmail.com;" & vHoy & ""
vBody = "Dear .......
'send report
DoCmd.SendObject acSendReport, vRpt, acFormatPDF, vTo, vCC, , vSubj, vBody
DoCmd.Close acReport, "Form_Report"
Next
End Sub