1

I am trying to print my userform.

Code:

Forms("frm_manager_stats_NEW").Printer.Orientation = acPRORLandscape
DoCmd.PrintOut , 1, 1, acLow, 1, False

I have also tried these lines of code:

DoCmd.PrintOut acPrintAll

and

DoCmd.PrintOut

The Error: When I press the command button to run the code Access debugs and gives me the option to close or debug, regardless which I press the application then closes.

What is happening?

dmorgan20
  • 353
  • 8
  • 33
  • Is there an error message? – Andy G Dec 15 '17 at 09:11
  • No error - It just hit the application debug saying the application has stopped responding, then the whole application closes – dmorgan20 Dec 15 '17 at 09:12
  • Try adding 'acPages' after dcmd.printout and before the first comma. also make sure the form is loaded and active. – wazz Dec 15 '17 at 09:25
  • didn't work - The printing form pops up so it must start the process but then stops working – dmorgan20 Dec 15 '17 at 09:41
  • Would is be caused if I had a tab control object on my userform? – dmorgan20 Dec 15 '17 at 09:50
  • 1
    I'd say this falls in the _unexpected crashes_ category. See [this answer](https://stackoverflow.com/a/40897483/7296893), and walk through the steps outlined there. – Erik A Dec 15 '17 at 10:07

1 Answers1

0

I think you have to first open your form in Print Preview mode and then print it out (like i have done it in one of my projects).

Please do the following:

DoCmd.OpenForm "YourUserFormName", acPreview
If Screen.ActiveForm.Name = "YourUserFormName" Then
DoCmd.PrintOut
End If

Try this and hopefully it will work for you like it worked for me.

Pulpitum
  • 1
  • 1