473,396 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Printing Multiple Forms

I want to create a button that will print multiple forms. Each form is
a list of various orders, and there are three separate forms:

-Standard Orders
-Rush Orders
-VIP Rush Orders

Each is based off its own query.

For certain company reasons, each order type (Standard, Rush, VIP
Rush) MUST be its own separate form.

Creating a button that will print all three is easy.

What I want is a button that will only print forms if they have data
on them. For example, if there are Standard Orders and Rush Orders,
but NO VIP Orders, I only want the first two forms printed.

I'm sure there's a simple solution, but I'm self-taught and not sure
what to do!

Thanks!

Mar 19 '07 #1
5 6392

I would recommend printing reports instead. One of the report events
is OnNoData. If the query the report is based on does not contain
records, printing can be canceled. In a button click event use the
OpenReport method of DoCmd to print them you'd include one line for
each report to print...

DoCmd.OpenReport "[reportName]", acViewNormal [or acViewPreview],
[Filter], [Where]

In the OnNoData event of the report enter Cancel=True.

Mar 19 '07 #2
On Mar 19, 2:22 pm, "storrboy" <storr...@sympatico.cawrote:
I would recommend printing reports instead. One of the report events
is OnNoData. If the query the report is based on does not contain
records, printing can be canceled. In a button click event use the
OpenReport method of DoCmd to print them you'd include one line for
each report to print...

DoCmd.OpenReport "[reportName]", acViewNormal [or acViewPreview],
[Filter], [Where]

In the OnNoData event of the report enter Cancel=True.
I've been working on forms all day. I of course meant to say
reports :)

Thanks!

Mar 19 '07 #3
On Mar 19, 2:22 pm, "storrboy" <storr...@sympatico.cawrote:
I would recommend printing reports instead. One of the report events
is OnNoData. If the query the report is based on does not contain
records, printing can be canceled. In a button click event use the
OpenReport method of DoCmd to print them you'd include one line for
each report to print...

DoCmd.OpenReport "[reportName]", acViewNormal [or acViewPreview],
[Filter], [Where]

In the OnNoData event of the report enter Cancel=True.
So I've got a button that does:

DoCmd.OpenReport "Standard", acViewPreview
DoCmd.OpenReport "Rush", acViewPreview
DoCmd.OpenReport "VIP Rush", acViewPreview

Each form has the OnNoData event set to "Cancel = True"

However, the problem here is that if either of the first two reports
are empty, it cancels the operation and I get a 2501 runtime error
that says "The OpenReport action was canceled." Which makes sense,
since the program thinks the whole thing is being cancelled.

How can I get around this? thanks!

Mar 20 '07 #4
<da*******@gmail.comwrote in message
news:11*********************@n76g2000hsh.googlegro ups.com...
On Mar 19, 2:22 pm, "storrboy" <storr...@sympatico.cawrote:
>I would recommend printing reports instead. One of the report events
is OnNoData. If the query the report is based on does not contain
records, printing can be canceled. In a button click event use the
OpenReport method of DoCmd to print them you'd include one line for
each report to print...

DoCmd.OpenReport "[reportName]", acViewNormal [or acViewPreview],
[Filter], [Where]

In the OnNoData event of the report enter Cancel=True.

So I've got a button that does:

DoCmd.OpenReport "Standard", acViewPreview
DoCmd.OpenReport "Rush", acViewPreview
DoCmd.OpenReport "VIP Rush", acViewPreview

Each form has the OnNoData event set to "Cancel = True"

However, the problem here is that if either of the first two reports
are empty, it cancels the operation and I get a 2501 runtime error
that says "The OpenReport action was canceled." Which makes sense,
since the program thinks the whole thing is being cancelled.

How can I get around this? thanks!
Add an error handler to your routine and in that test the Err.Number and ignore
when it is number 2501.

On Error GoTo ErrHandler

(code)

Egress:
Exit Sub

ErrHandler:
Select Case Err.Number
Case 2501
Resume Next
Case Else
MsgBox Err.Description
Resume Egress
End Select
End Sub

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Mar 20 '07 #5
I prefer to have my no data reports print with the detail containing
text that says something to the effect that no data exists for the
report rewuested. That way you always get output that is valid.
Maybe it the auditor side of me (I did audit work for 9 years) but not
haveing a report generated on no data leaves you to ASS-U-ME that the
non-generation of the report was the correct event. Setting up an
invisible label with a solid background on top of all other data in
the detail that is toggled to visible on no data is one way to skin
the cat.

On Mar 20, 10:26 am, dancol...@gmail.com wrote:
On Mar 19, 2:22 pm, "storrboy" <storr...@sympatico.cawrote:
I would recommend printing reports instead. One of the report events
is OnNoData. If the query the report is based on does not contain
records, printing can be canceled. In a button click event use the
OpenReport method of DoCmd to print them you'd include one line for
each report to print...
DoCmd.OpenReport "[reportName]", acViewNormal [or acViewPreview],
[Filter], [Where]
In the OnNoData event of the report enter Cancel=True.

So I've got a button that does:

DoCmd.OpenReport "Standard", acViewPreview
DoCmd.OpenReport "Rush", acViewPreview
DoCmd.OpenReport "VIP Rush", acViewPreview

Each form has the OnNoData event set to "Cancel = True"

However, the problem here is that if either of the first two reports
are empty, it cancels the operation and I get a 2501 runtime error
that says "The OpenReport action was canceled." Which makes sense,
since the program thinks the whole thing is being cancelled.

How can I get around this? thanks!

Mar 20 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jody Gelowitz | last post by:
I am having a problem with printing selected pages. Actually, the problem isn't with printing selected pages as it is more to do with having blank pages print for those pages that have not been...
0
by: Programatix | last post by:
Hi, I am working on the PrintDocument, PrintDialog, PageSetupDialog and PrintPreviewControl components of Visual Studio .NET 2003. My developement machine is running Windows XP. There are...
0
by: Programatix | last post by:
Hi, I am working on the PrintDocument, PrintDialog, PageSetupDialog and PrintPreviewControl components of Visual Studio .NET 2003. My developement machine is running Windows XP. There are...
9
by: Jody Gelowitz | last post by:
I am trying to find the definition of "Safe Printing" and cannot find out exactly what this entitles. The reason is that I am trying to print contents from a single textbox to no avail using the...
0
by: DotNetDummy | last post by:
Hi all, I am trying to set the printing setting e.g duplex mode etc. on a default printer when I.E object started printing a particular html doc. Here's the partial code, any help would be...
4
by: Russ | last post by:
To ASP.NET printing experts: My Asp.net web form needs to print some reports at the client side. I've been trying to research this and find some confusing and conflicting information in previous...
8
by: Rick Lederman | last post by:
I am using a PrintDocument and PrintDialog to print. The first time that I print it works, but when I try to print a second time without exiting the entire program I get an...
7
by: chemlight | last post by:
I am having an issue with HTML elements not printing when positioned absolutely when they extend beyond the first page. I am working on some foreign tax refund forms. The forms are cut into multiple...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.