Print Report (1 Viewer)

Gismo

Registered User.
Local time
Tomorrow, 00:10
Joined
Jun 12, 2017
Messages
1,087
Hi All,

I have a form where I select the records to be printed in a report

Below is the code I use and as it should appear
It opens the report as hidden
Then opens the standard printer popup
Print
Close the report

but now instead of printing the report, it prints the form where I have selected the records to be printed

Please could you advise

Private Sub Print_Click()
On Error GoTo Print_Click_Err

DoCmd.SetWarnings False

DoCmd.OpenReport "DAW Sheet - Final", acViewPreview, , , acHidden
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, "DAW Sheet - Final"

DoCmd.OpenQuery "Update DAW Printed", acViewNormal, acEdit
DoCmd.OpenQuery "Update DAW Printed By", acViewNormal, acEdit
DoCmd.Requery "CS Raised - Mail Sub"
DoCmd.RunMacro "Update DAW Sheet TBL", , ""
DoCmd.Close acForm, "Menu"
DoCmd.OpenForm "Menu", acNormal, "", "", , acNormal
DoCmd.SetWarnings True

Print_Click_Exit:
Exit Sub

Print_Click_Err:
MsgBox Error$
Resume Print_Click_Exit

End Sub
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:10
Joined
May 7, 2009
Messages
16,480
you need to open the Report Visible (not Hidden).
 

Ranman256

Well-known member
Local time
Today, 17:10
Joined
Apr 9, 2015
Messages
4,102
DoCmd.OpenReport "DAW Sheet - Final", acViewPreview
 

Minty

AWF VIP
Local time
Today, 22:10
Joined
Jul 26, 2013
Messages
9,288
If you open it

DoCmd.OpenReport "DAW Sheet - Final", acViewNormal

It will simply print directly to the default printer for the report?
 

Gismo

Registered User.
Local time
Tomorrow, 00:10
Joined
Jun 12, 2017
Messages
1,087
Hi,

I had it as hidden as I dont really need the user to see the report
But seems like it then does not print the actual report when hidden, instead it prints the current open form which does not make any sense as the code defines the report and not the form

Honestly, I am a bit confused with the parameters as there are 2 view mode variants, AcView and AcWindow Mode

ACView I have as preview and then I had windowmode as hidded, which does not print the report


1642049799341.png
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:10
Joined
May 7, 2009
Messages
16,480
use Minty's suggestion to print it directly.
unless you are changing "Printer" parameters visibly.
 

Gismo

Registered User.
Local time
Tomorrow, 00:10
Joined
Jun 12, 2017
Messages
1,087
yes i need to give the user the option to change printer settings
 

Users who are viewing this thread

Top Bottom