Report / PDF Question

luism

Registered User.
Local time
Today, 02:20
Joined
Sep 30, 2012
Messages
43
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

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
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!
 
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

did not work :(
 
which On Format? It has to be in the subreport's On Format event

And btw: for ever skip "doesn't work" the most useless phrase. See my signature.
 
Sorry, I'm not understanding the On Format thing.

What I tried to do on the main report (Rpt_hicontarcts) is switch from
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

to
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

While "Print" still shows those text boxes/labels Visible.
Email is still ignoring it and not making Visible those specific fields.
 
You do not understand which words in:

"It has to be in the subreport's On Format event"
 
I see what you mean now. Under the Properties of the report.

There is no On Format available. See screen shot please.
 

Attachments

  • Format.jpg
    Format.jpg
    70.7 KB · Views: 119
Does anyone have any other ideas/code I can try?

Thanks!
 
*bump*

Would really like to know if anyone else has any suggestions?
 

Users who are viewing this thread

Back
Top Bottom