Filtering Report Data

  • Thread starter Thread starter JamesJ
  • Start date Start date
J

JamesJ

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
 
JamesJ said:
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] & """"
 
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 said:
JamesJ said:
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] & """"
 
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]

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.


JamesJ said:
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] & """"
 
Back
Top