TecknoFreak
Member
- Local time
- Today, 08:20
- Joined
- Dec 21, 2021
- Messages
- 57
Hello everyone,
So after couple of hrs of reading similar problems to mine in this forum I still haven't been able to find something close enough I can try. (Sorry I'm new to Access)
What I'm trying to do is get some values from another Module to fill the Email Body using values from 2 other modules but just cant find a way to make that to work.
Everything else is working great!
This is the Email Report I'm working on
So after couple of hrs of reading similar problems to mine in this forum I still haven't been able to find something close enough I can try. (Sorry I'm new to Access)
What I'm trying to do is get some values from another Module to fill the Email Body using values from 2 other modules but just cant find a way to make that to work.

This is the Email Report I'm working on
Code:
Option Compare Database
Private Sub EmailReport_Click()
Dim strPdfFile As String
Dim oApp As Object
Dim oEmail As Variant
Dim strAttach1 As String
Dim strAttach2 As String
Dim strAttach3 As String
Set oApp = CreateObject("Outlook.application")
Set oEmail = oApp.CreateItem(0)
'Output Reports
Rem <!-- Each Range Report need to match the report names to export. & _
IMPORTANT: If the DB change locations/paths make sure to change them here too, MS Access will & _
not do this for you. -->
DoCmd.OpenReport "R_610_Mailing_Summary", acViewReport, , , acHidden
DoCmd.OutputTo acOutputReport, "R_610_Mailing_Summary", acFormatPDF, "P:\Eng\Labs & Ranges\LOGBOOK_DATABASE\Reports\610 Reports\610 Range Weekly Report.pdf", False
DoCmd.Close acReport, "R_610_Mailing_Summary", acSaveNo
DoCmd.OpenReport "R_IAAIMS_Mailing_Summary", acViewReport, , , acHidden
DoCmd.OutputTo acOutputReport, "R_IAAIMS_Mailing_Summary", acFormatPDF, "P:\Eng\Labs & Ranges\LOGBOOK_DATABASE\Reports\IAAIMS Reports\IAAIMS RF Range Weekly Report.pdf", False
DoCmd.Close acReport, "R_IAAIMS_Mailing_Summary", acSaveNo
DoCmd.OpenReport "R_IARIMS_Mailing_Summary", acViewReport, , , acHidden
DoCmd.OutputTo acOutputReport, "R_IARIMS_Mailing_Summary", acFormatPDF, "P:\Eng\Labs & Ranges\LOGBOOK_DATABASE\Reports\IARIMS Reports\IARIMS RCS Range Weekly Report.pdf", False
DoCmd.Close acReport, "R_IARIMS_Mailing_Summary", acSaveNo
'Set Reports as Attachments
Rem <!-- make sure to correlate the attachments to each of the reports you wish to send -->
strAttach1 = "P:\folder\subfolder\LOGBOOK_DATABASE\Reports\IAAIMS Reports\IAAIMS Weekly Report.pdf"
strAttach2 = "P:\folder\subfolder\LOGBOOK_DATABASE\Reports\IARIMS Reports\IARIMS Weekly Report.pdf"
strAttach3 = "P:\folder\subfolder\LOGBOOK_DATABASE\Reports\610 Reports\610 Weekly Report.pdf" ' ------------ (Not Emailing this Report but Generating)
'Generate email here
With oEmail
.Display
.To = "**************************"
.CC = "*************************"
.Subject = "Ranges Summary Report (Week Ending) " & Date - Weekday(Date) - 1
.HTMLBody = "Please refer to the attachment name to see the corresponding Range Report. <br><br>" _
& "Attention: Jeff ******* <br><br>" _
& "<B><U>IAAIMS Report</B></U><br>" _
& "Total QTY of Edges: " & "<U>Me.WSToEd.Value</U><br>" _
& "Total QTY of Sys Installs: " & "<U>Me.WSToSI.Value</U><br>" _
& "Total QTY of BK-4 Material: " & "<U>Me.TBK4.Value</U><br><br>" _
& "<B><U>IARIMS Report</B></U><br>" _
& "Total QTY of Edges: " & "<U>Me.WSToPT.Value</U><br>" _
& "Total QTY of Wedges: " & "<U>Me.WSToWe.Value</U><br>" _
& "Total QTY CRO/MICAP's : " & "<U>Me.TCoatedEdges.Value</U><br><br><br>" _
& "<I>Report Generated by " & Environ("UserName") & " using the Ranges MS Access Database created by Angel S.</I>"
.Attachments.Add strAttach1
.Attachments.Add strAttach2
End With
End Sub
Last edited: