A.D. Tejpal
adtp at airtelmail.in
Fri Oct 29 04:18:18 CDT 2010
Brad,
Apparently you wish to play with the report in report view and
thereafter, before printing, carry out selective suppression of detail
section, say by setting Cancel = True in its format event, as dictated by
suitable conditional check.
Following course of action is suggested (based upon Access 2010 on Win
XP):
Place suitable code in detail section's format event in report's module.
Sample code:
'===============================
Private Sub Detail_Format(Cancel As Integer, _
FormatCount As Integer)
If <<MyConditionExpression>> Then
Cancel = True
End If
End Sub
'===============================
Place the following code in dbl click event of page header section in
report's module:
'===============================
Private Sub PageHeaderSection_DblClick(Cancel As Integer)
DoCmd.RunCommand acCmdPrintPreview
End Sub
'===============================
After opening the report, whenever you are ready for final stage, dbl
click in page header section, will take you to the preview mode, accompanied
by firing of format event, delivering desired output.
Best wishes,
A.D. Tejpal
------------
----- Original Message -----
From: Brad Marks
To: Access Developers discussion and problem solving
Sent: Friday, October 29, 2010 07:52
Subject: Re: [AccessD] How
tosuppressspecificreportlineswhileusingacViewReport
Rocky,
You are right, filtering can be done in other ways to suppress detail lines.
In some cases, however, we would like to suppress subtotal lines also. This
looks like it is going to be a bit more complicated.
Thanks for your help.
Brad
-----Original Message-----
From: accessd-bounces at databaseadvisors.com on behalf of Rocky Smolin
Sent: Thu 10/28/2010 7:32 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] How to
suppressspecificreportlineswhileusingacViewReport
Now why do you suppose they had to make the Format events not to fire when
using Report View?
If course if you were trying to suppress certain detail lines, doesn't the
filtering features of Report View allow that?
R
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brad Marks
Sent: Thursday, October 28, 2010 3:08 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] How to suppress
specificreportlineswhileusingacViewReport
Rocky,
Yes, the Format Event fires if we don't use Report View.
The catch is that we are using features of Report View that we don't want to
give up.
Brad
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Thursday, October 28, 2010 5:04 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] How to suppress specific
reportlineswhileusingacViewReport
So if you left that out:
DoCmd.OpenReport "Report100",,,, acViewPreview
Just like we do in A2003, would the Format event fire?
Rocky
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brad Marks
Sent: Thursday, October 28, 2010 2:15 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] How to suppress specific report
lineswhileusingacViewReport
Rocky,
Here is more info about Report View...
Access 2007 includes a new view for reports called Report view. You get a
static snapshot of your data with the traditional Print Preview, but with
the new Report view, you can dynamically filter the data and drill down to
print only the information you need. Just right-click inside a control and
select various filtering options from a contextual shortcut menu.
From
http://blogs.techrepublic.com.com/msoffice/?p=134?target=_blank
Brad
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Thursday, October 28, 2010 3:55 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] How to suppress specific report lines
whileusingacViewReport
Oh. 2007. All bets are off. Actually not familiar with acViewReport
parameter - must be new for 2007? What's it mean?
Rocky
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brad Marks
Sent: Thursday, October 28, 2010 1:47 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] How to suppress specific report lines while
usingacViewReport
Rocky,
Thanks for the help, I appreciate it.
It appears that for some reason the Format event is not getting initiated
when I use "acViewReport".
For a quick test, I simply put a MSGBOX in the Format event and opened the
report. I did not receive any message.
I am using 2007, in case that makes a difference.
Thanks again,
Brad
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Thursday, October 28, 2010 3:31 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] How to suppress specific report lines
whileusingacViewReport
Brad:
I use the Format event of the Detail section all the time to do this.
Preview or Print shouldn't matter.
I use:
If Nz(Me.fldMWCIInventoryQuantity) = 0 And Nz(Me.Allocation) = 0 Then
Me.MoveLayout = False
Me.NextRecord = True
Me.PrintSection = False
End If
Sub in your own conditions on the If. This was cribbed directly from the
Detail_Format event module. But it works in the Format event of any
section.
HTH
Rocky
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brad Marks
Sent: Thursday, October 28, 2010 1:09 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] How to suppress specific report lines while
usingacViewReport
We are using this command to open a Report DoCmd.OpenReport "Report100",
acViewReport, "", "", acNormal
I would like to suppress some detail lines and subtotals based on the value
of another field.
The "On Format" event apparently does not get initiated with acViewReport
The "On Paint" event does get initiated and can detect the conditions when
we would like to suppress a line by looking at the value of a field.
The catch is that when I try to use
Me.ABC.Visible = False
I receive the following
Error 32521 - You can't change the value of this property in the OnPaint
event
There is probably an easy way to do this. I must be missing something.
Thanks,
Brad