Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reports in Landscape 1

Status
Not open for further replies.

KAZZANeedsHelp

Technical User
Apr 25, 2009
6
AU
Hi all

Another question - Hopefully it is easier to fix.

I have created a number of reports in landscape view.

They work perfectly.

The problem is now and then, when I least expect it they open in portrait view. I can't work out why it does this but it more commonly occurs if I open a landscape report after viewing a portrait report (but not all the time).

Is there some code I can enter to force the page to open in landscape view? If yes, then what is it?
Regards
Kazza
 
In Acc2K2 & later, you can use the new printer object model:
Code:
Dim prt As Printer
Set prt = Reports("your report").Printer
prt.Orientation = acPRORLandscape
DoCmd.PrintOut
Set prt = Nothing

Illegitimi non carborundum.
 
There were versions of Access where the printer options didn't stick. This was generally fixed with applying all service packs. You could fix temporarily by setting all Name Autocorrect options off.

Duane
Hook'D on Access
MS Access MVP
 
There were versions of Access where the printer options didn't stick.

Not to mention the hotfixes didn't stick. This was a problem from Acc2002 - 2007. We went to automating everything in code, which works, but really should not be necessary.
Please post back if the SP's solved this - we have 2k3 & 2k7 installations, but are still running production in 2000 (because it works right in that respect).
Thanks!

Illegitimi non carborundum.
 
Hi there,

thanks for your replies (remember I am a learner).

Just a note that the problem is with viewing the report.

On the assumption that the code works for viewing the report in landscape view I entered the code as part of the form's On Open command.

Was this the correct place to put it?

I am getting the following error:

Compile Error: User-defined type not defined.

The code I entered was:
****************
Private Sub Report_Open(Cancel As Integer)

On Error GoTo Err_Report


Dim prt As Printer
Set prt = Reports("StaffTrainingDeletionBasedOnSelection").Printer
prt.Orientation = acPRORLandscape
DoCmd.PrintOut
Set prt = Nothing

Exit_Report:
Exit Sub

Err_Report:
MsgBox Error$
Resume Exit_Report
End Sub
******************************

Can you please advise me what I am doing wrong?
Thanks heaps

Kazza
 
The code I posted would go in the procedure or form (command button?) that opens the report.

Illegitimi non carborundum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top