print landscape (VB)

G

Guest

Heres the code for printing the form
Dim stDocName As String
Dim MyForm As Form

stDocName = "UpdateInvoice"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acForm, MyForm.Name, False

Whats the code to make the print job in landscape mode?

Thanks for the help,
Greg
 
G

Guest

Normally it is not good practice to print out forms. But maybe you have your
reasons for it. In that case maybe this might send you in the right direction:

---
Me.Form.Printer.Orientation = acPRORLandscape
DoCmd.RunCommand acCmdPrintPreview
---
note: I tried above code in 2007 and it worked. Maybe in 2003 or earlier
versions the constants (being "acPRORLandscape") are different. Try finding
the correct one.

But last and not least I would strongly recommend using a report to do your
printjobs (that's what they are there for).

hth
 
G

Guest

Thanks for the reply
Yes After more evaluation I think you are right in this situation
I have already created a report but need to change it to landscape mode, how
would I go about doing that?

Thanks Again
 
G

Guest

Hi greg,

Good to hear you are creating the report. For what about the report settings
i'd advice you to try something like:

With Me.Report.Printer
.Orientation = acPRORLandscape '-2007 code see previous post
End With

As stated in the previous post this is 2007 code. Try finding the correct
options for earlier versions (which version are you using?)

hth
 
J

John W. Vinson

Thanks for the reply
Yes After more evaluation I think you are right in this situation
I have already created a report but need to change it to landscape mode, how
would I go about doing that?

If you're using 2003 or earlier, open the Report in design view, and select
File... Page Setup from the menu. Choose Landscape (and, if desired,
printer-specific information such as the feed tray or paper size). That
information will be saved as part of the report's properties.

John W. Vinson [MVP]
 

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