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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|