Suppressing Details

E

Erin

Hi All,

Is there a way to suppress details for a specific group?
For instance I want my report to read:

Class A
Class A Details
Class A Details
Class A Details
Total Class A

Total Class B

Grand Total

So that the reader can see the detail for Class A, but not
for Class B. Any suggestions would be appreciated.
Thanks.
 
R

Rick Brandt

Erin said:
Hi All,

Is there a way to suppress details for a specific group?
For instance I want my report to read:

Class A
Class A Details
Class A Details
Class A Details
Total Class A

Total Class B

Grand Total

So that the reader can see the detail for Class A, but not
for Class B. Any suggestions would be appreciated.
Thanks.

In the Format event for the Detail section...

Cancel = ([Class] = "Class B")
 
E

Erin

Rick,

Thanks for your help, but I'm doing something wrong.

I tried typing Cancel = ([CATEGORY] = "Political
Contributions") directly into the Event Format box
(CATEGORY is the name of the field where Political
Contributions may be found), but I recieved an error
message "Microsoft Access can't find the macro Cancel =
([CATEGORY] = "Political Contributions").""

Then I tried putting it in the code as follows:

Private Sub Detail1_Format(Cancel As Integer, FormatCount
As Integer)
Cancel = ([CATEGORY] = "Political Contributions")
End Sub

but then I got the error message "Microsoft Access can't
find the field 'CATEGORY' in your expression.

Any idea what I'm doing wrong? I appreciate you help.
Thanks.
-----Original Message-----
Erin said:
Hi All,

Is there a way to suppress details for a specific group?
For instance I want my report to read:

Class A
Class A Details
Class A Details
Class A Details
Total Class A

Total Class B

Grand Total

So that the reader can see the detail for Class A, but not
for Class B. Any suggestions would be appreciated.
Thanks.

In the Format event for the Detail section...

Cancel = ([Class] = "Class B")


.
 
R

Rick Brandt

Erin said:
Rick,

Thanks for your help, but I'm doing something wrong.

I tried typing Cancel = ([CATEGORY] = "Political
Contributions") directly into the Event Format box
(CATEGORY is the name of the field where Political
Contributions may be found), but I recieved an error
message "Microsoft Access can't find the macro Cancel =
([CATEGORY] = "Political Contributions").""

This is definitely wrong. You need the entry "[Event Procedure]" in the property box
and then add code to the module as you do below.
Then I tried putting it in the code as follows:

Private Sub Detail1_Format(Cancel As Integer, FormatCount
As Integer)
Cancel = ([CATEGORY] = "Political Contributions")
End Sub

but then I got the error message "Microsoft Access can't
find the field 'CATEGORY' in your expression.

Any idea what I'm doing wrong? I appreciate you help.
Thanks.

This looks ok to me. Code behind reports can't make references to fields in the
report's RecordSet unless those fields are actually used in a control on the report.
Is the field [CATEGORY] referenced in a control somewhere on the report? If not just
add a hidden control using that field as the ControlSource and then the code should
be able to pick it up.
 
E

Erin

Rick,

There was such a control in the report, but apparently it
needed to be in the detail section. Once I added one
there it worked. Thanks much for your help.

Erin
-----Original Message-----
Erin said:
Rick,

Thanks for your help, but I'm doing something wrong.

I tried typing Cancel = ([CATEGORY] = "Political
Contributions") directly into the Event Format box
(CATEGORY is the name of the field where Political
Contributions may be found), but I recieved an error
message "Microsoft Access can't find the macro Cancel =
([CATEGORY] = "Political Contributions").""

This is definitely wrong. You need the entry "[Event
Procedure]" in the property box
and then add code to the module as you do below.
Then I tried putting it in the code as follows:

Private Sub Detail1_Format(Cancel As Integer, FormatCount
As Integer)
Cancel = ([CATEGORY] = "Political Contributions")
End Sub

but then I got the error message "Microsoft Access can't
find the field 'CATEGORY' in your expression.

Any idea what I'm doing wrong? I appreciate you help.
Thanks.

This looks ok to me. Code behind reports can't make references to fields in the
report's RecordSet unless those fields are actually used in a control on the report.
Is the field [CATEGORY] referenced in a control somewhere on the report? If not just
add a hidden control using that field as the
ControlSource and then the code should
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top