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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page Setup on Form Load

Status
Not open for further replies.

DanAuber

IS-IT--Management
Apr 28, 2000
255
FR
I want to write some VB code that so every time I load a certain form (so this code would be in the On Load event of the Form) - the page setup is switched to Landscape and the left and right margins are reduced to 20 mm. Can anyone help me with this code ? - Hoping this is a very simple request

Thanks

Dan

 
This is from the help file. You should be able to modify it to meet your needs.

Orientation determines the layout. acPRORLandscape is the constant for landscape. The margins are in twips (1 in = 1440)
Code:
Sub SetPrinter(strFormname As String)

    DoCmd.OpenForm FormName:=strFormname, view:=acDesign, _
                   datamode:=acFormEdit, windowmode:=acHidden
    
    With Forms(form1).Printer
    
        .TopMargin = 1440
        .BottomMargin = 1440
        .LeftMargin = 1440
        .RightMargin = 1440
    
        .ColumnSpacing = 360
        .RowSpacing = 360
    
        .ColorMode = acPRCMColor
        .DataOnly = False
        .DefaultSize = False
        .ItemSizeHeight = 2880
        .ItemSizeWidth = 2880
        .ItemLayout = acPRVerticalColumnLayout
        .ItemsAcross = 6
    
        .Copies = 1
        .Orientation = acPRORLandscape
        .Duplex = acPRDPVertical
        .PaperBin = acPRBNAuto
        .PaperSize = acPRPSLetter
        .PrintQuality = acPRPQMedium
    
    End With
    
    DoCmd.Close objecttype:=acForm, objectname:=strFormname, _
                Save:=acSaveYes


End Sub
 
How are ya DanAuber . . .

For starters . . . setup a report instead!

From my experience, printing forms is always prone to diaster! . . . The reason I never print forms, in the first place!

I've found that printing reports after you've set [blue]Page Setup[/blue] . . . [blue]always holds true to that setup![/blue]

[blue]Do a report instead! . . . [/blue]



Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top