Variables won't print to printer

G

Guest

Hello all,

How can I get variables passed to a report from a form to print on my printer?

I have a unbound text box in my report 's Page Header section that displays
custom text depending on values selected from my form. Everything works as
expected while viewing in the report window. If I print the report everything
prints except the values passed from the form.

The unbound text box is named "txtCustomer" that's in the Report Header
section. In the Report Headers "On Format" event I have the following
procedure:

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
Dim headText As String

headText = "Product Type Listing for "

Me.txtCustomer = headText & Forms![Application Form]!ProductType.Value
End Sub

-Sky
 
A

Albert D. Kallal

Hum, if it displays while previewing the report..and then you go file->print
(while STILL viewing the report)...it should work.

Perhaps you accident set the text box to not visible?

Perhaps the text box needs to be enlarged. Try making the text box MUCH
wider....(just for testing).

Perhaps the font is a color..and you inkjet colors (except for black) have
run out??

Do you have a pdf printer....can you print to that...and see what happens?
 
G

Guest

Hi Al,

I traced the problem back to the code for the Combo Box where selections are
made. The line that says " Me.ProductType = Null " caused the printing
problem. Once I removed that line, everything prints correctly including any
variable data passed from the form.

Here's the code in question:

Private Sub ProductType_AfterUpdate()
DoCmd.OpenReport "Product Type", acViewPreview
DoCmd.Maximize
RunCommand acCmdFitToWindow
Me.ProductType = Null
End Sub

Thanks Al for your time. I feel silly not figuring this out sooner :-(

-Sky
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top