View Single Post
  #3  
Old December 20th, 2009, 08: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]