-
WSrhconley
AskWoody LoungerThanks, Wendell.
-
WSrhconley
AskWoody LoungerThanks again, Rory. Your code appears to be working. I’m always amazed how it takes a week or so before unexpected behavior (bugs) start to show up.
-
WSrhconley
AskWoody LoungerRory,
I don’t have a Report Header in my report, only a Page Header that prints on every page. Accordingly, I placed your code in the Page Header section. I tried revising your code somewhat by placing the following in the Page Header print event:
Private Sub PageHeaderSection_Print(Cancel As Integer, PrintCount As Integer)
If Me.Page = 1 Then
blnPrinted = Not blnPrinted
ElseIf Me.Page = 2 Then
blnPrinted = blnPrinted
ElseIf Me.Page = 3 Then
blnPrinted = Not blnPrinted
ElseIf Me.Page = 4 Then
blnPrinted = blnPrinted
End If
End SubI ran my 2 page report and it appears to be functioning properly. Of course, the code, as I revised it, accommodates reports of up to 4 pages in length, but does it make sense that this should work?
-
WSrhconley
AskWoody LoungerRory,
Your code works perfectly for a one page report. However, when my purchase order gets lengthy, and spans multiple pages, I run into trouble. I know I didn’t mention that multiple page reports were a possibility. In my case, if the user views the additional report pages in Print Preview, the 3 additional pages print upon exiting Print Preview without printing the main report. There are also some other wierd, logic-related printing problems, too. I haven’t had time to digest the code, but I’m sure it has to do with even and odd pages, the firing of the print command, and the use of Boolean logic to correct that. Is there a way to accommodate the possibility of multiple page main reports and the need to have the 3 additional reports print ONLY if the user prints the main report, regardless of length? Thank you for your help.
-
WSrhconley
AskWoody LoungerThank you, sir.
-
WSrhconley
AskWoody LoungerThanks, Mark. That took care of it. Any idea of the rationale behind this behavior?
-
WSrhconley
AskWoody LoungerThanks again, Rory. You know, you really should consider doing this for a living!
-
WSrhconley
AskWoody LoungerRory,
Many thanks! Again, you solved one of my problems. Thank you.
A quick question…I can follow the logic of the Report Open and Report Close events. What does the ReportHeader_Print code do?
-
WSrhconley
AskWoody LoungerRory,
I added your code to my main report, placing the first 3 lines in the Declarations section. The report does not run, however, and I am presented with the following error message:
The expression On Open you entered as the event property setting produced the following error:
Procedure declaration does not match description of event or procedure having the same name.
* The expression may not result in the name of a macro, the name of a user-defined function, or [Event Property].
* There may have been an error evaluating the function, event, or macro.Any ideas?
-
WSrhconley
AskWoody LoungerMorning, Gary. The user prints the main report (Purchase Order) by going to File/Print or by pressing the Print command button on the Access command bar. I have not created a custom print button just for the PO report.
-
WSrhconley
AskWoody LoungerThe following code does the job for me:
Private Sub Report_Close()
DoCmd.OpenReport “rptPOTANDCPG1”
DoCmd.OpenReport “rptPOTANDCPG2”
DoCmd.OpenReport “rptPOTANDCPG3”
End SubNow, I’d like these 3 additional reports to print ONLY if the user PRINTS the main report. I tried adding this code to the On Print events in the main report Detail and Footer sections…the 3 additional reports will print before the main report is displayed in Print Preview, but the main report will not print (it will not queue to the printer). If I add this code to the On Close event of the main report, the main report and the 3 additional reports will print, but this results in the 3 additional reports ALWAYS printing, even if the user does not print the main report. How can I get the 3 additional reports to print ONLY if the use prints the main report? Thanks for the help.
-
WSrhconley
AskWoody LoungerThanks, Charlotte. Your solution took care of it.
-
WSrhconley
AskWoody LoungerCharlotte,
Forgive my ignorance, but can you provide additional detail? The query now returns ‘X’ number of records, each with a date equal to or less than the parameter value. Where would I create the expression?
-
WSrhconley
AskWoody LoungerThomas,
Thank you. Your method worked perfectly. Thanks for taking the time to come up with this solution.
-
WSrhconley
AskWoody LoungerThomas,
The report already has a Purchase Order Group Header section (for the PO information) and a Detail section (for the line items). When I place the counter in the PO Group Footer section, the count control simply returns the number of line items associated with each purchase order.
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
.NET 8.0 Desktop Runtime (v8.0.16) – Windows x86 Installer
by
WSmeyerbos
58 minutes ago -
Neowin poll : What do you plan to do on Windows 10 EOS
by
Alex5723
21 minutes ago -
May 31, 2025—KB5062170 (OS Builds 22621.5415 and 22631.5415 Out-of-band
by
Alex5723
51 minutes ago -
Discover the Best AI Tools for Everything
by
Alex5723
32 minutes ago -
Edge Seems To Be Gaining Weight
by
bbearren
24 minutes ago -
Rufus is available from the MSFT Store
by
PL1
22 hours, 35 minutes ago -
Microsoft : Ending USB-C® Port Confusion
by
Alex5723
1 day ago -
KB5061768 update for Intel vPro processor
by
drmark
7 hours, 9 minutes ago -
Outlook 365 classic has exhausted all shared resources
by
drmark
3 hours, 20 minutes ago -
My Simple Word 2010 Macro Is Not Working
by
mbennett555
20 hours, 29 minutes ago -
Office gets current release
by
Susan Bradley
23 hours, 7 minutes ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
2 days, 13 hours ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
1 day, 21 hours ago -
Stop the OneDrive defaults
by
CWBillow
2 days, 14 hours ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
2 days, 23 hours ago -
X Suspends Encrypted DMs
by
Alex5723
3 days, 2 hours ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
3 days, 2 hours ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
3 days, 3 hours ago -
OpenAI model sabotages shutdown code
by
Cybertooth
3 days, 3 hours ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
2 days, 15 hours ago -
Enabling Secureboot
by
ITguy
2 days, 22 hours ago -
Windows hosting exposes additional bugs
by
Susan Bradley
3 days, 11 hours ago -
No more rounded corners??
by
CWBillow
3 days, 7 hours ago -
Android 15 and IPV6
by
Win7and10
2 days, 21 hours ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
3 days, 23 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
4 days, 2 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
3 days, 21 hours ago -
Windows Update orchestration platform to update all software
by
Alex5723
4 days, 9 hours ago -
May preview updates
by
Susan Bradley
3 days, 21 hours ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
3 days, 12 hours ago
Recent blog posts
Key Links
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.