 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

July 12th, 2012, 02:30 PM
|
|
Registered User
|
|
Join Date: Jul 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Shutter Bar opens when I print report
I am using Access 2010, with a database that was created in an earlier version, and converted to 2007.
The code I used to print the report in Access 2007 does not react the same way. Instead of just printing 2 copies of the report as I want it to do, it prints the two copies, and then opens the left Shutter Bar menu. I have set it up so that users do not see any of the menu options. "Display navigation pane" is not checked in the Access Options menu. Here is the code that runs on the command button:
Private Sub printorder_Click()
DoCmd.SelectObject acReport, "NFSsmokingORD", True
DoCmd.PrintOut , , , , 2
End Sub
I did find a function on acCmdWindowHide, but all it does is hide the form I am using to print the report.
I know enough about Access just to make me dangerous- am very much a beginner with code. Any ideas? Thanks!
|
|

July 12th, 2012, 02:52 PM
|
|
Authorized User
|
|
Join Date: Oct 2010
Posts: 64
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Hi,
Try using:
Docmd.OpenReport "NSFsmokingORD", acViewNormal,,,acHidden
instead of SelectObject.
Remember to close the object after printing using Docmd.Close.
I haven't tried this, but can't see why it won't work.
HTH.
Malc.
|
|

July 12th, 2012, 04:53 PM
|
|
Registered User
|
|
Join Date: Jul 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Getting Closer
Thank you Malcolm,
With your help, I'm getting closer. I used the code below, and it worked (did not open Shutter Bar), but it didn't print the specific record (the record open on the form). It wanted to print ALL records. Can you tell me what I'm missing?
I have a main form (Customer Form) and a subform NFS Orders which are linked by Customer Number. Each record has a unique Order Number. The report's command button to print is on the subform.
Private Sub printorder_Click()
DoCmd.OpenReport "NFSsmokingORD", acViewNormal, , , acHidden
DoCmd.PrintOut , , , , 2
DoCmd.Close
End Sub
Again, thanks. I really appreciate that you took the time to reply to my post.
|
|

July 12th, 2012, 05:40 PM
|
|
Authorized User
|
|
Join Date: Oct 2010
Posts: 64
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Hi,
Amend the OpenReport command to use a WhereCondition:
DoCmd.OpenReport "NFSsmokingORD", acViewNormal, , "[OrderNumber] = " & Me.txtOrderNumber, acHidden
I'm assuming the underlying query of the report has a column named OrderNumber and that the subform NFS Orders has a textbox control named txtOrderNumber. Please amend accordingly if different.
Alternatively, if the report is always used to print single orders you could place a reference to the subform control in the criteria section of the OrderNumber column. You can even set the recordsource of the report in the Open Event to retrieve the specific record too. Many different ways to achieve the end result!
HTH.
Malc.
|
|
 |