Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
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
 
Old July 12th, 2012, 02:30 PM
Registered User
 
Join Date: Jul 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Red face 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!
 
Old July 12th, 2012, 02:52 PM
Authorized User
 
Join Date: Oct 2010
Posts: 64
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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.
 
Old July 12th, 2012, 04:53 PM
Registered User
 
Join Date: Jul 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Red face 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.
 
Old July 12th, 2012, 05:40 PM
Authorized User
 
Join Date: Oct 2010
Posts: 64
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Report print set-up lryckman Access 4 February 25th, 2008 09:04 AM
how to print sub report NagarajuK Crystal Reports 0 December 3rd, 2007 10:05 AM
Crystal report Viewer Not Showing Control Bar simjith Crystal Reports 0 May 20th, 2007 05:28 AM
VS 2002 Crystal Report opens Seagate crystal 8 tusis_1 Crystal Reports 0 May 12th, 2007 11:45 AM
print report lazio Crystal Reports 0 November 1st, 2004 08:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.