preview is different then printout

J

Jean-Paul

Hi,
When I write:

DoCmd.OpenReport "Voorbereidend_document_beeldvorming_GASV",acViewPreview

I get a perfect report with 2 header lines
Then I click the print button and everything is nicely printed.

When I write
DoCmd.OpenReport "Voorbereidend_document_beeldvorming_GASV"

I get a printout without the 2 lines in the header

These lines are generated as follow

Private Sub Report_Activate()
If Forms!hoofdmenu!Te_printen = "Doc1" Then
Me!Titel1 = "VOORBEREIDEND DOCUMENT BEELDVORMING Datum: " &
Format(Date, "d mmm yyyy")
Else
Me!Titel1 = "VOORBEREIDEND DOCUMENT KLASSENRAAD Datum: " &
Format(Date, "d mmm yyyy")
End If
Me!Titel2 = "LEERKRACHT: " & Forms!hoofdmenu!Gebruiker & " VAK: " &
Forms!hoofdmenu!watgeefik & " NIV: " & Forms!Leerlingen!Niveau

End Sub

What to do?
Thanks
 
J

Jeff Boyce

Jean-Paul

Have you tried putting that header-naming routine in any other events? Like
"on format"?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
F

fredg

Hi,
When I write:

DoCmd.OpenReport "Voorbereidend_document_beeldvorming_GASV",acViewPreview

I get a perfect report with 2 header lines
Then I click the print button and everything is nicely printed.

When I write
DoCmd.OpenReport "Voorbereidend_document_beeldvorming_GASV"

I get a printout without the 2 lines in the header

These lines are generated as follow

Private Sub Report_Activate()
If Forms!hoofdmenu!Te_printen = "Doc1" Then
Me!Titel1 = "VOORBEREIDEND DOCUMENT BEELDVORMING Datum: " &
Format(Date, "d mmm yyyy")
Else
Me!Titel1 = "VOORBEREIDEND DOCUMENT KLASSENRAAD Datum: " &
Format(Date, "d mmm yyyy")
End If
Me!Titel2 = "LEERKRACHT: " & Forms!hoofdmenu!Gebruiker & " VAK: " &
Forms!hoofdmenu!watgeefik & " NIV: " & Forms!Leerlingen!Niveau

End Sub

What to do?
Thanks

The Report Activate event does NOT fire if the report is just printed.
It only fires when the report is previewed.
Place your code in the Report's Report Header Format event.
The Forms must still be open when the report is run.
 
Top