Filtering part of a report

  • Thread starter Thread starter PJ
  • Start date Start date
P

PJ

I am trying to write a report that gives a total number of records. However
I only need to list the detail of the records which meet certain criteria.
(Yes/no) is a similar situation. I cannot filter the whole report because
then my totals for all records will not be correct. Is there a way to
filter portions of a report so that only certain data appear in the detail
portion of a report?

Thanks.
 
By "protions" can we assume you mean records?
If I understand correctly, you can add some code to the On Format event of
your detail section to cancel the rendering of the section:

Cancel = (Your True/False Expression Here)
ie:
Cancel = (Me.chkMyCheckBox = True)
 
Thanks Duane, but that did not seem to work. Let me see if I can explain a
little bit better of what I need.

I am running a single report from a single query. In my report I need to
list the total number of records in my query, broken down into yes and no
categories.
That part is no problem. Hoever, I only need to list the detial of the
records which fall under the "no" category. If I try and filter the whole
report it throws my total numbers off. Therefore, I need to be able to
filter the detail section of my report so that only the "no" records appear.


It seems that there should be an easy way to do this but every avenue/trick
that I have thought of has been unsuccessful.

Thanks.
 
My solution did not filter the whole report.

What is the code that you entered into the On Format event of your detail
section?
Can you be more specific (bound control names and values) regarding the
records you don't want to display?
'records which fall under the "no" category'
doesn't provide a control name and value.
 
The code that I entered is:

Cancel=([settled]=0)


This refers to my query, which is:

settled:IIf([settle-dt]<Date(),1,0)

I need to count all transactions that have or will settle. I total each of
these in the report header. (The total number of transactions that have
already settled is X) This is the total number of trades. I also have in
the header (The total number of transactions that have not settled is X).
Now, I have these calculating no problem. Its only the transactions that
have not settled that I need to show up in the detail section of the report.


I have not used On Format before so I am probably just not using it
correctly.
 
You must find the VBA module window for the On Format event of the detail
section. This is usually done by building code from clicking the [...] button
to the right of the event property.

Go there. It should look a bit like notepad. Enter your code and check the
results.
[settled] must be a bound field in your detail section of the report.

--
Duane Hookom
Microsoft Access MVP


PJ said:
The code that I entered is:

Cancel=([settled]=0)


This refers to my query, which is:

settled:IIf([settle-dt]<Date(),1,0)

I need to count all transactions that have or will settle. I total each of
these in the report header. (The total number of transactions that have
already settled is X) This is the total number of trades. I also have in
the header (The total number of transactions that have not settled is X).
Now, I have these calculating no problem. Its only the transactions that
have not settled that I need to show up in the detail section of the report.


I have not used On Format before so I am probably just not using it
correctly.



Duane Hookom said:
My solution did not filter the whole report.

What is the code that you entered into the On Format event of your detail
section?
Can you be more specific (bound control names and values) regarding the
records you don't want to display?
'records which fall under the "no" category'
doesn't provide a control name and value.
 
Thanks for your help, but it still does not seem to work. "Duane Hookom"
wrote:
You must find the VBA module window for the On Format event of the detail
section. This is usually done by building code from clicking the [...] button
to the right of the event property.

Go there. It should look a bit like notepad. Enter your code and check the
results.
[settled] must be a bound field in your detail section of the report.

--
Duane Hookom
Microsoft Access MVP


PJ said:
The code that I entered is:

Cancel=([settled]=0)


This refers to my query, which is:

settled:IIf([settle-dt]<Date(),1,0)

I need to count all transactions that have or will settle. I total each of
these in the report header. (The total number of transactions that have
already settled is X) This is the total number of trades. I also have in
the header (The total number of transactions that have not settled is X).
Now, I have these calculating no problem. Its only the transactions that
have not settled that I need to show up in the detail section of the report.


I have not used On Format before so I am probably just not using it
correctly.



Duane Hookom said:
My solution did not filter the whole report.

What is the code that you entered into the On Format event of your detail
section?
Can you be more specific (bound control names and values) regarding the
records you don't want to display?
'records which fall under the "no" category'
doesn't provide a control name and value.


--
Duane Hookom
Microsoft Access MVP


:

Thanks Duane, but that did not seem to work. Let me see if I can explain a
little bit better of what I need.

I am running a single report from a single query. In my report I need to
list the total number of records in my query, broken down into yes and no
categories.
That part is no problem. Hoever, I only need to list the detial of the
records which fall under the "no" category. If I try and filter the whole
report it throws my total numbers off. Therefore, I need to be able to
filter the detail section of my report so that only the "no" records appear.


It seems that there should be an easy way to do this but every avenue/trick
that I have thought of has been unsuccessful.

Thanks.


:

By "protions" can we assume you mean records?
If I understand correctly, you can add some code to the On Format event of
your detail section to cancel the rendering of the section:

Cancel = (Your True/False Expression Here)
ie:
Cancel = (Me.chkMyCheckBox = True)

--
Duane Hookom
Microsoft Access MVP


:

I am trying to write a report that gives a total number of records. However
I only need to list the detail of the records which meet certain criteria.
(Yes/no) is a similar situation. I cannot filter the whole report because
then my totals for all records will not be correct. Is there a way to
filter portions of a report so that only certain data appear in the detail
portion of a report?

Thanks.
 
You stated "but it still does not seem to work". How about telling us what
you are seeing since we can't see your report.

What is your exact code in the report?
--
Duane Hookom
Microsoft Access MVP


PJ said:
Thanks for your help, but it still does not seem to work. "Duane Hookom"
wrote:
You must find the VBA module window for the On Format event of the detail
section. This is usually done by building code from clicking the [...] button
to the right of the event property.

Go there. It should look a bit like notepad. Enter your code and check the
results.
[settled] must be a bound field in your detail section of the report.

--
Duane Hookom
Microsoft Access MVP


PJ said:
The code that I entered is:

Cancel=([settled]=0)


This refers to my query, which is:

settled:IIf([settle-dt]<Date(),1,0)

I need to count all transactions that have or will settle. I total each of
these in the report header. (The total number of transactions that have
already settled is X) This is the total number of trades. I also have in
the header (The total number of transactions that have not settled is X).
Now, I have these calculating no problem. Its only the transactions that
have not settled that I need to show up in the detail section of the report.


I have not used On Format before so I am probably just not using it
correctly.



:

My solution did not filter the whole report.

What is the code that you entered into the On Format event of your detail
section?
Can you be more specific (bound control names and values) regarding the
records you don't want to display?
'records which fall under the "no" category'
doesn't provide a control name and value.


--
Duane Hookom
Microsoft Access MVP


:

Thanks Duane, but that did not seem to work. Let me see if I can explain a
little bit better of what I need.

I am running a single report from a single query. In my report I need to
list the total number of records in my query, broken down into yes and no
categories.
That part is no problem. Hoever, I only need to list the detial of the
records which fall under the "no" category. If I try and filter the whole
report it throws my total numbers off. Therefore, I need to be able to
filter the detail section of my report so that only the "no" records appear.


It seems that there should be an easy way to do this but every avenue/trick
that I have thought of has been unsuccessful.

Thanks.


:

By "protions" can we assume you mean records?
If I understand correctly, you can add some code to the On Format event of
your detail section to cancel the rendering of the section:

Cancel = (Your True/False Expression Here)
ie:
Cancel = (Me.chkMyCheckBox = True)

--
Duane Hookom
Microsoft Access MVP


:

I am trying to write a report that gives a total number of records. However
I only need to list the detail of the records which meet certain criteria.
(Yes/no) is a similar situation. I cannot filter the whole report because
then my totals for all records will not be correct. Is there a way to
filter portions of a report so that only certain data appear in the detail
portion of a report?

Thanks.
 
Back
Top