A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Filtering Report Data



 
 
Thread Tools Display Modes
  #1  
Old December 20th, 2009, 08:55 PM posted to microsoft.public.access.reports
JamesJ[_5_]
external usenet poster
 
Posts: 32
Default Filtering Report Data

Access 2007 sp2.

I'm trying to filter report data the same way I filter my form data
but it appears to be different for reports.
In my form I have a combo box based on a lookup table and I have
code in the After Update of the combo box and set the the record source of
the
form based on the selection in the combo box.
This works fine in the form but not the report.
When I put the combo box on the report header I have no "drop-down button"
for
the combo box. Also, there doesn't seem to be an After Update property of
the combo box on a report.
I am able to filter the records by creating a command button and using the
Filter = and
Filter On. Although this will require me to create 15 buttons for each of
the genre.
(I'll probably go with some kind of option group if this is the only way to
go.)

I'm opening the report from a command button and the report opens in view
mode.

Any help will be appreciated,
James

  #2  
Old December 20th, 2009, 09:17 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Filtering Report Data

JamesJ wrote:

Access 2007 sp2.

I'm trying to filter report data the same way I filter my form data
but it appears to be different for reports.
In my form I have a combo box based on a lookup table and I have
code in the After Update of the combo box and set the the record source of
the
form based on the selection in the combo box.
This works fine in the form but not the report.
When I put the combo box on the report header I have no "drop-down button"
for
the combo box. Also, there doesn't seem to be an After Update property of
the combo box on a report.
I am able to filter the records by creating a command button and using the
Filter = and
Filter On. Although this will require me to create 15 buttons for each of
the genre.
(I'll probably go with some kind of option group if this is the only way to
go.)

I'm opening the report from a command button and the report opens in view
mode.



Reports are static so there are no clickable items in a
report.


The "usual" way to open filtered forms and reports is to use
the OpenForm/Report methods' WhereCondition argument. The
argument usus the same string as the Filter property. E,g,

DoCmd.OpenReport "the report", acViewPreview, _

for number type fields:
WhereCondition:= "[some field] = " & Me.[the combo box]
or, for Text fields:
WhereCondition:= "[some field] = """ & Me.[the combo
box] & """"

--
Marsh
MVP [MS Access]
  #3  
Old December 20th, 2009, 09:34 PM posted to microsoft.public.access.reports
JamesJ[_5_]
external usenet poster
 
Posts: 32
Default Filtering Report Data

I found that I'm able to filter using:

Me.Filter = "GenreID=1"
Me.FilterOn = True

using an option group.
Takes up a lot of space, though.

James

"Marshall Barton" wrote in message
...
JamesJ wrote:

Access 2007 sp2.

I'm trying to filter report data the same way I filter my form data
but it appears to be different for reports.
In my form I have a combo box based on a lookup table and I have
code in the After Update of the combo box and set the the record source of
the
form based on the selection in the combo box.
This works fine in the form but not the report.
When I put the combo box on the report header I have no "drop-down button"
for
the combo box. Also, there doesn't seem to be an After Update property of
the combo box on a report.
I am able to filter the records by creating a command button and using the
Filter = and
Filter On. Although this will require me to create 15 buttons for each of
the genre.
(I'll probably go with some kind of option group if this is the only way
to
go.)

I'm opening the report from a command button and the report opens in view
mode.



Reports are static so there are no clickable items in a
report.


The "usual" way to open filtered forms and reports is to use
the OpenForm/Report methods' WhereCondition argument. The
argument usus the same string as the Filter property. E,g,

DoCmd.OpenReport "the report", acViewPreview, _

for number type fields:
WhereCondition:= "[some field] = " & Me.[the combo box]
or, for Text fields:
WhereCondition:= "[some field] = """ & Me.[the combo
box] & """"

--
Marsh
MVP [MS Access]


  #4  
Old December 21st, 2009, 04:42 AM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Filtering Report Data

Sure.

OTOH, the option group has to be on a form and then the
option group's value has to be passed to the report so your
report code can use it. Using the WhereCondition argument
and a combo box allows it all to be done in one place with
just a couple of lines of code.

Your app, your call.
--
Marsh
MVP [MS Access]


JamesJ wrote:
I found that I'm able to filter using:

Me.Filter = "GenreID=1"
Me.FilterOn = True

using an option group.
Takes up a lot of space, though.


"Marshall Barton" wrote
JamesJ wrote:

Access 2007 sp2.

I'm trying to filter report data the same way I filter my form data
but it appears to be different for reports.
In my form I have a combo box based on a lookup table and I have
code in the After Update of the combo box and set the the record source of
the
form based on the selection in the combo box.
This works fine in the form but not the report.
When I put the combo box on the report header I have no "drop-down button"
for
the combo box. Also, there doesn't seem to be an After Update property of
the combo box on a report.
I am able to filter the records by creating a command button and using the
Filter = and
Filter On. Although this will require me to create 15 buttons for each of
the genre.
(I'll probably go with some kind of option group if this is the only way
to
go.)

I'm opening the report from a command button and the report opens in view
mode.



Reports are static so there are no clickable items in a
report.


The "usual" way to open filtered forms and reports is to use
the OpenForm/Report methods' WhereCondition argument. The
argument usus the same string as the Filter property. E,g,

DoCmd.OpenReport "the report", acViewPreview, _

for number type fields:
WhereCondition:= "[some field] = " & Me.[the combo box]
or, for Text fields:
WhereCondition:= "[some field] = """ & Me.[the combo
box] & """"

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:01 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.