Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display and clear report filter using ribbon

Status
Not open for further replies.

kimmba

Technical User
Apr 18, 2011
8
US
I have an access 2007 report where the Default View property is set to Report View. I have an unbound textbox on the same report where the Control Source is "=[Report].[Filter]". When the report is run, any field can be filtered by right-clicking the field and selecting appropriate criteria.

The unbound textbox then displays the filters as created:
Filters: (([qryAllRecords].[strLastName] Like "a*")) AND ([qryAllRecords].[DOB]>=#2/1/2011#). Right click a filtered field and select "Clear filter from [fieldname]". The filter is cleared and the unbound textbox is dynamically updated. If no filters remain, it is blank.

In the user environment, I do not want the user to have access to the shortcut menus, so I created a ribbon for the report that has a group with these idMsos:
<control idMso="FiltersMenu" label="Filter" enabled="true"/>
<control idMso="FilterClearAllFilters" label="Undo Filter" enabled="true"/>.

These work to filter and remove filters in the report similar to using the shortcut menus. When a filter is applied the unbound textbox is updated. However, the FilterClearAllFilters does NOT dynamically update the unbound textbox displaying the filter. Only when the report is closed and then re-opened does the unbound textbox display correctly.

The integrity of the report depends on the filter displaying correctly. Does anyone know how to modify the idMso or add some other code to dynamically update the unbound textbox when using the ribbon?

Thank you!
 
Couldn't figure out how to make this work. A workaround is to put
Me.Filter = "" and Me.FilterOn = False in the Report_Open event. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top