Hello everyone,
Before anything, thank you for all that make this such a great place for many of us that need help.
Here's my problem.
I have a report that responds and works great when PRINTING it.
However, when Access converts the report into PDF some functionality needed goes Poof.
Here's how this works
I have "Print Contract" and "Email Contract" buttons
- Print button runs under an OnClick macro to open the report in Print Preview (Works fine)
- Email button runs under an OnClick macro "EmailDatabaseObject" that outputs the report as a PDF with the necessary email address and subject line (Works fine except some data is not showing as expected)
My main report (rpt_hicontracts) has the following VBA code
Yes, my main report (rpt_hicontracts) has three subreports and rpt_hicontractsp4subrpt is in it.
Print button works fine, all the needed text boxes/labels are Visible.
When email button is pressed everything is fine up to that point, the text boxes/labels are not visible.
I tried to move the if else conditions to the Private Sub Report_Load() part but that didn't work. And I guess it's clear that Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer) may only apply/work when Printing... so I'm stuck.
I tried a variation of things but none of them worked. Any help with this would be highly appreciated!
Before anything, thank you for all that make this such a great place for many of us that need help.
Here's my problem.
I have a report that responds and works great when PRINTING it.
However, when Access converts the report into PDF some functionality needed goes Poof.
Here's how this works
I have "Print Contract" and "Email Contract" buttons
- Print button runs under an OnClick macro to open the report in Print Preview (Works fine)
- Email button runs under an OnClick macro "EmailDatabaseObject" that outputs the report as a PDF with the necessary email address and subject line (Works fine except some data is not showing as expected)
My main report (rpt_hicontracts) has the following VBA code
Code:
Option Compare Database
'Fetch Employee's logged in UserName
Private Sub Report_Load()
txtUser.Value = DLookup("[EmpFName]", "Tbl_Emps", "[UserName]=forms!Frm_Login!lgnUserName") & " " & DLookup("[EmpLName]", "Tbl_Emps", "[UserName]=forms!Frm_Login!lgnUserName")
End Sub
'Show Signature Only for Specific Emp
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If txtUser = "John Doe" Then
Me!Rpt_HIContractsP4SubRpt!CSSignature.Visible = True
Me!Rpt_HIContractsP4SubRpt!User_Label.Visible = True
Me!Rpt_HIContractsP4SubRpt!CEO_Label.Visible = True
Me!Rpt_HIContractsP4SubRpt!txtHICDate3.Visible = True
Else
Me!Rpt_HIContractsP4SubRpt!CSSignature.Visible = False
Me!Rpt_HIContractsP4SubRpt!User_Label.Visible = False
Me!Rpt_HIContractsP4SubRpt!CEO_Label.Visible = False
Me!Rpt_HIContractsP4SubRpt!txtHICDate3.Visible = False
End If
End Sub
Print button works fine, all the needed text boxes/labels are Visible.
When email button is pressed everything is fine up to that point, the text boxes/labels are not visible.
I tried to move the if else conditions to the Private Sub Report_Load() part but that didn't work. And I guess it's clear that Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer) may only apply/work when Printing... so I'm stuck.
I tried a variation of things but none of them worked. Any help with this would be highly appreciated!