The PrintOut Action was canceled

Hi Experts
i have an access application 2007 that worked for all users, except one user that he is not able to print
The PrintOut Action was canceled
Private Sub Button522_Click()
On Error GoTo Err_Button522_Click

    Dim Docname As String
    Dim MyForm As Form

    Docname = "Form52print1"
    Set MyForm = Screen.ActiveForm
    DoCmd.SelectObject A_FORM, Docname, True
    DoCmd.PrintOut
    DoCmd.SelectObject A_FORM, MyForm.Name, False

Exit_Button522_Click:
    Exit Sub

Err_Button522_Click:
    MsgBox Error$
    Resume Exit_Button522_Click
    
End Sub

Open in new window


any suggestion ?
LVL 1
AZZA-KHAMEESAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Are you sure the machine has a compliant default printer setup? I've seen issues like this where the user has switched their printer to a label printer (or something like that), and Access doesn't like it.

Also, be sure the machine is fully up to date regarding Office and Windows updates.

Finally - you really should not print Forms. Instead, create a Report and print that. Forms are for entering/editing data, and Reports are for previewing/printing data.

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
Jeffrey CoachmanMIS LiasonCommented:
Not sure where you got all of that complex code from...

...But to print a record (or records) on the current form, all you need is code like this on a button n that form:
   
   
 'Print the current record
    DoCmd.PrintOut acSelection

Open in new window

or    
   
 'Print all records
    DoCmd.PrintOut acPrintAll

Open in new window


So like Scott, I think you should move this functionality to a "report" where printing is a lot simpler, and easier to control.

JeffCoachman
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
Microsoft Access

From novice to tech pro — start learning today.