Share via

Printing an Access form

Anonymous
2013-04-08T12:06:09+00:00

Just upgraded from Office 2003 to 2007.   A form in 2003 which included a sub-form printed on one page - landscape.  Since installing 2007, the sub-form does not print.  I reloaded Access 2003 with the same result.  Also went from Windows XP to Windows 7 so I ma not sure what is causing the problem.

Any help.  Bob

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. Anonymous
    2013-09-04T15:26:28+00:00

    Although Printing Forms is not ideal, if there is a situation where you must then try this

    This function has been tested to work in MS Access 2013 but should also be compatible with 2007 and 2010

    It requires both parts be completed to work properly (Call to the function and the Manual Page set up on the Print Preview)

    In your OnClick Event (Print Button on the SubForm)

    Add the call to a sub

     Call printSubformInLandscape(Screen.ActiveForm, Screen.ActiveForm.ActiveControl.Form.Name)

    Cut and paste this in as your sub

    Sub printSubformInLandscape(ByRef ParentForm, ByVal SubForm)

    On Error GoTo Err_printSubformInLandscape

        Dim MyForm As Form

        Dim prtr As Access.Printer

        Set MyForm = ParentForm

        Set prtr = Application.Printer

        Set MyForm.Printer = prtr

        DoCmd.SelectObject acForm, SubForm, True

        prtr.Orientation = acPRORLandscape

        DoCmd.PrintOut

        DoCmd.SelectObject acForm, MyForm.Name, False

    Exit_printSubformInLandscape:

        Exit Sub

    Err_printSubformInLandscape:

        MsgBox Err.Description & " printSubformInLandscape "

        Resume Exit_printSubformInLandscape

    End Sub

    You must Also go into your SubForm in Design Mode

     - For Access 2013 --> Select File - Print - Print Preview and change the Orientation to Landscape

    • Save your form changes

    Test it

    2 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2013-10-01T01:52:09+00:00

    I tried this in 2010 and it only prints the subform.

    1 person found this answer helpful.
    0 comments No comments
  3. ScottGem 68,810 Reputation points Volunteer Moderator
    2013-04-08T12:15:41+00:00

    The short answer is don't print forms. Forms were not meant for printing but for entering and viewing data.

    In a report you may not need a subform, but can use Grouping to accomplish the same thing.

    1 person found this answer helpful.
    0 comments No comments
  4. Anonymous
    2013-10-01T12:10:57+00:00

    I'd endorse what Daniel and Scott have said; printing a form is rarely a good solution.  A form will generally be designed with screen display in mind, whereas a report can cater much better for printed output.  You'll find an example of a report which outputs the data from a the current record of a form which includes subforms as InvoicePDF.zip in my public databases folder at:

    https://skydrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169

    If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.

    While this little demo file is primarily intended to illustrate how to output a report as a PDF file, the 'Open Invoice' button on the form simply opens a report in print preview.  With minimal modification to the button's code it could send it to a printer of course.  The report in question does include a subreport, for the totals, but is mostly designed by grouping the report and using group headers and footers in addition to the detail section.

    0 comments No comments
  5. Anonymous
    2013-04-08T12:08:41+00:00

    How are you printing it, VBA?  Can you provide us with your code.

    Have you ensured the 'Display When' property is set to 'Always' and not 'Screen Only'?

    Normally you print a report, not a form.  You'd be better off basing a report on your form and would get much better control and results.

    0 comments No comments