Access World Forums

Access World Forums (https://www.access-programmers.co.uk/forums/index.php)
-   Forms (https://www.access-programmers.co.uk/forums/forumdisplay.php?f=9)
-   -   Adding a button to request a filter (https://www.access-programmers.co.uk/forums/showthread.php?t=244463)

Juliaataccess 03-28-2013 06:56 AM

Adding a button to request a filter
 
Hi,

I have a form and want to filter records on demand, as each time the filter will be based on a different set of criteria.

It works well, execpt that the user has to remember to go to the Ribbon or the Quick Access Toolbar to click on the "Filter" button so they can choose the relevant filter criteria - usually from the Organisation Type and Borough fields - eg. Carers in Tower Hamlets.

I have struggled to find a way to put a button for this option into the form. I'd like one to appear beside these 2 main filtering fields so the user can click inside the field and click on this, instead of having to remember to go to the Ribbon or Quick Access Toolbar for it.

Can you help me with this query ?


Regards,
Julia

CJ_London 03-28-2013 08:04 AM

Re: Adding a button to request a filter
 
Is the object you are trying to filter a subform?

If so then either in the onchange event for each combo or if you want a button, in the button on click event put code similar to this

Code:


YourSubFormName.Form.Filter = "[SomeField] = " & combo1 & " AND [SomeOtherField] = " & combo2
YourSubFormName.Form.FilterOn=true

If the values in your combo are text then substitute

" & combo2 with '" & combo2 & "'"


All times are GMT -8. The time now is 07:53 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World