Need help with Access VBA code to modify printing an open form

Below is the code I have in place right now to print an open form:

Private Sub Command68_Click()
On Error GoTo Err_Command68_Click

    Printer.PaperSize = acPRPS11x17
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.PrintOut acSelection
 DoCmd.RunCommand acCmdZoom75
Exit_Command68_Click:
    Exit Sub

Err_Command68_Click:
    MsgBox Err.Description
    Resume Exit_Command68_Click
   
End Sub

When I run this code I get a message "acCmdZoom75 is not currently available".  I am trying to reduce the print size of this form via this line of code but Access is not recognizing it.
CRGmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PatHartmanCommented:
The code you are using refers to menu items in Access 95.  No one alive knows what item 8 on the Form bar is anymore and it was bad code when it was written because there were constants that should have been used instead of "8".  So, I would start again and rebuild the procedure.  Use the wizard if you can't write the VBA yourself and then convert it to VBA using the convert button on the ribbon.
Here's a sample:
Private Sub cmdPrint_Click()
On Error GoTo cmdPrint_Click_Err
    DoCmd.SelectObject acForm, "Form1", True
    DoCmd.RunCommand acCmdPrint
    DoCmd.SelectObject acForm, Screen.ActiveForm.name, False
cmdPrint_Click_Exit:
    Exit Sub
cmdPrint_Click_Err:
    MsgBox Err.Number & "--" & Err.Description
    Resume cmdPrint_Click_Exit
End Sub

Open in new window

Your problem is most likely that the zoom method applies only to screen viewing.  It doesn't apply to printing.  Access doesn't have the great "fit to page" feature that Excel has.

Your best solution would be to create a report and print that.  Forms are not optimized for printing and you'll have much better control if you make a report.
0
CRGmanAuthor Commented:
Thanks...unfortunately that is the answer I was expecting.   I will write a report and new code to print.
0
Helen FeddemaCommented:
It isn't a good idea to print a form in any case.  The best solution is to create a report, then print it filtered by a value on the form.  See my Access Archon article on this topic:
http://www.helenfeddema.com/Files/accarch227.zip
Here is a screen shot:
Printing a Filtered ReportThe code on the form has two filtering methods.
0
Helen FeddemaCommented:
And here is a screen shot of the filtered report (for another customer):
Filtered report
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CRGmanAuthor Commented:
Thanks!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Office Productivity

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.