TecknoFreak
Member
- Local time
- Today, 14:51
- Joined
- Dec 21, 2021
- Messages
- 57
I created a form based on a report as I rather show the form and not the report to the rest of the db users.By that, I mean, I was hoping you would tell me you double-click on the form's name on the Navigation Pane, or you click on a button from your menu form, etc.
But all is populated based on a Report that is populated as Closed using a query for each of the 2 Reports. The Report just Open as hidden to populate the Report data and then Closed once populated to convert to PDF before sending as attachment in an email.
The trigger to those Reports comes from 2 different VBA Class/Modules Objects
For IAAIMS Report
Code:
Private Sub Report_Load()
GetData
End Sub
Sub GetData()
Me.TMechLEF = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='MECH / LEF'"), 0)
Me.TMechILEF = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='MECH / ILEF'"), 0)
Me.TSysInstLEF = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='SYS INS / LEF'"), 0)
Me.TSysInstILEF = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='SYS INS / ILEF'"), 0)
Me.TSysInstAIL = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='SYS INS / AIL'"), 0)
Me.TBonAssWTTE = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='BA / WTTE'"), 0)
Me.TBonAssHTTE = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='BA / HTTE'"), 0)
Me.TBonAssAIL = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='BA / AIL'"), 0)
Me.TApertBAND34 = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='APERTURE - 34'"), 0)
Me.TApertBAND2 = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='APERTURE - LB'"), 0)
Me.TBK4 = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='MATERIAL BK4'"), 0)
FailMechLEF = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='MECH / LEF'" & "and [PassFail]='Fail'"), 0)
FailMechILEF = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='MECH / ILEF'" & "and [PassFail]='Fail'"), 0)
FailSysInstLEF = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='SYS INS / LEF'" & "and [PassFail]='Fail'"), 0)
FailSysInstILEF = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='SYS INS / ILEF'" & "and [PassFail]='Fail'"), 0)
FailSysInstAIL = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='SYS INS / AIL'" & "and [PassFail]='Fail'"), 0)
FailBonAssWTTE = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='BA / WTTE'" & "and [PassFail]='Fail'"), 0)
FailBonAssHTTE = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='BA / HTTE'" & "and [PassFail]='Fail'"), 0)
FailBonAssAIL = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='BA / AIL'" & "and [PassFail]='Fail'"), 0)
FailApertBAND34 = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='APERTURE - 34'" & "and [PassFail]='Fail'"), 0)
FailApertBAND2 = Nz(DSum("[TotalParts]", "Q_IAAIMS_WeeklyReport", "[Part]='APERTURE - LB'" & "and [PassFail]='Fail'"), 0)
Me.CMechLEF = Me.TMechLEF - FailMechLEF
Me.CMechILEF = Me.TMechILEF - FailMechILEF
Me.CSysInstLEF = Me.TSysInstLEF - FailSysInstLEF
Me.CSysInstILEF = Me.TSysInstILEF - FailSysInstILEF
Me.CSysInstAIL = Me.TSysInstAIL - FailSysInstAIL
Me.CBonAssWTTE = Me.TBonAssWTTE - FailBonAssWTTE
Me.CBonAssHTTE = Me.TBonAssHTTE - FailBonAssHTTE
Me.CBonAssAIL = Me.TBonAssAIL - FailBonAssAIL
Me.CApertBAND34 = Me.TApertBAND34 - FailApertBAND34
Me.CApertBAND2 = Me.TApertBAND2 - FailApertBAND2
Me.WSToEd = Me.TMechLEF + Me.TMechILEF + Me.TBonAssWTTE + Me.TBonAssHTTE + Me.TBonAssAIL
Me.WSToSI = Me.TSysInstLEF + Me.TSysInstILEF + Me.TSysInstAIL
End Sub
For IARIMS Report
Code:
Private Sub Report_Load()
GetData
End Sub
Sub GetData()
Me.TMechLEF = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Type]='MECH / LEF'"), 0)
Me.TMechILEF = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Type]='MECH / ILEF'"), 0)
Me.TBonAssWTTE = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Type]='BA / WTTE'"), 0)
Me.TBonAssHTTE = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Type]='BA / HTTE'"), 0)
Me.TBonAssAIL = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Type]='BA / AIL'"), 0)
Me.TCoreLEF = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Type]='LEF CoreBond'"), 0)
Me.TCoreILEF = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Type]='ILEF CoreBond'"), 0)
Me.TStriRADO = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Type]='RADOME - Mid/Lam'"), 0) + Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Type]='RADOME - Full Up'"), 0) + Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Type]='RADOME - Stripped'"), 0)
Me.TStriFLAP = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Type]='FLAP - Coated'"), 0)
Me.WTLEF = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Wedges]='LEF Wedge'" & "and [PassFail]='Pass'"), 0)
Me.WTILEF = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Wedges]='ILEF Wedge'" & "and [PassFail]='Pass'"), 0)
Me.WTWTTE = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Wedges]='WTTE Wedge'" & "and [PassFail]='Pass'"), 0)
Me.WTAILE = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Wedges]='AIL Wedge'" & "and [PassFail]='Pass'"), 0)
Me.WTHTTE = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Wedges]='HTTE Wedge'" & "and [PassFail]='Pass'"), 0)
Me.WCLEF = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Wedges]='LEF Wedge'" & "and [PassFail]='Fail'"), 0)
Me.WCILEF = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Wedges]='ILEF Wedge'" & "and [PassFail]='Fail'"), 0)
Me.WCWTTE = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Wedges]='WTTE Wedge'" & "and [PassFail]='Fail'"), 0)
Me.WCAILE = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Wedges]='AIL Wedge'" & "and [PassFail]='Fail'"), 0)
Me.WCHTTE = Nz(DSum("[TotalParts]", "Q_IARIMS_WeeklyReport", "[Wedges]='HTTE Wedge'" & "and [PassFail]='Fail'"), 0)
Me.WSToPT = [TMechLEF] + [TMechILEF] + [TBonAssWTTE] + [TBonAssAIL] + [TBonAssHTTE] + [TCoreLEF] + [TCoreILEF] + [TStriRADO] + [TStriFLAP]
Me.WSToWe = [WTLEF] + [WTILEF] + [WTWTTE] + [WTAILE] + [WTHTTE] + [WCLEF] + [WCILEF] + [WCWTTE] + [WCAILE] + [WCHTTE]
End Sub
Then those 2 Reports are loaded based on EmailReport_Click () from a button located in Dashboard.
Code:
DoCmd.OpenReport "R_IAAIMS_Mailing_Summary", acViewReport, , , acHidden
DoCmd.OutputTo acOutputReport, "R_IAAIMS_Mailing_Summary", acFormatPDF, "L:\Labs\LOGBOOK_DATABASE\Reports\IAAIMS Reports\IAAIMS 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, "L:\Labs\LOGBOOK_DATABASE\Reports\IARIMS Reports\IARIMS Weekly Report.pdf", False
DoCmd.Close acReport, "R_IARIMS_Mailing_Summary", acSaveNo
Last edited: