Chi Is Current
asked on
Enable Filter by Form on Subform
Access 2010: I would like to use "filter by form" on a subform; however, filter buttons are grayed out. Is there a way I can enable this functionality on a subform?
"Allow Filters" property = Yes, on subform (and main form) properties
"Allow Filters" property = Yes, on subform (and main form) properties
ASKER
Thank you, mbizup for your reply.
Yes, my subform IS *bound* to a table, though the subform is not in a child / parent relationship to the main form.
I am very surprised to notice ALL the "Sort & Filter" buttons greyed out - even when I place the cursor in a bound control in the subform (!).
Yes, my subform IS *bound* to a table, though the subform is not in a child / parent relationship to the main form.
I am very surprised to notice ALL the "Sort & Filter" buttons greyed out - even when I place the cursor in a bound control in the subform (!).
Ah - okay.
An alternative would be to set up unbound controls either in the header of the subform (if you are using continuous forms or single form view), or on the main form to filter the subform by code either in the After Update events of those unbound controls or a command button's click event. Custom filtering of a subform like this is very common, and there are a lot of examples of this here on EE.
An alternative would be to set up unbound controls either in the header of the subform (if you are using continuous forms or single form view), or on the main form to filter the subform by code either in the After Update events of those unbound controls or a command button's click event. Custom filtering of a subform like this is very common, and there are a lot of examples of this here on EE.
Here's a sample (Access 2010) which is a basic example of the idea in my precious post. This was uploaded in an earlier question.
Fwiw, it also shows the Filter By Form option enabled for a subform, which like yours has no master/child links to the main form.
Maybe if you upload a sample of your database we can pinpoint why this is not working for you.Filters1.accdb
Fwiw, it also shows the Filter By Form option enabled for a subform, which like yours has no master/child links to the main form.
Maybe if you upload a sample of your database we can pinpoint why this is not working for you.Filters1.accdb
ASKER
Thank you for your ideas. Somehow, I'm still not getting this.
Please find example attached. There are only 3 records in the db; however, the subform displays only ONE of them(?)! Additionally, using the combo box at the top of the main form, it IS possible to locate AND DISPLAY the other two records.
You can see the 'Sort and Filter' buttons remain grayed out when a textbox in the subform has focus. ???
Clearly, there is something going on here that I have yet to understand. I have never had this issue w/ subforms in the past. Gotta admit, I'm very new to Access 2010.... Perhaps something else different here?
Thank you for your assistance!
EXP-Filter.accdb
Please find example attached. There are only 3 records in the db; however, the subform displays only ONE of them(?)! Additionally, using the combo box at the top of the main form, it IS possible to locate AND DISPLAY the other two records.
You can see the 'Sort and Filter' buttons remain grayed out when a textbox in the subform has focus. ???
Clearly, there is something going on here that I have yet to understand. I have never had this issue w/ subforms in the past. Gotta admit, I'm very new to Access 2010.... Perhaps something else different here?
Thank you for your assistance!
EXP-Filter.accdb
I think I confused you by posting two seperate approaches in different comments in the same thread.
For the sample you posted, you should remove the master child links and remove the recordsource for the main form (the recordsource should be blank).
See this sample, and take a look at the After Update code for your combo box.
That code sets the subform filter, and clears it if the combo is null/blank.
EXP-Filter.accdb
For the sample you posted, you should remove the master child links and remove the recordsource for the main form (the recordsource should be blank).
See this sample, and take a look at the After Update code for your combo box.
That code sets the subform filter, and clears it if the combo is null/blank.
EXP-Filter.accdb
ASKER
Thank you, mbizup. I see the difference deleting master child links makes. And I see how you revised the combo box on the main form as a filter.
However, in your example, the "Sort and Filter" buttons in the ribbon bar still remain blank, even when the cursor is placed in a textbox on the subform. Are you seeing this on your end?
~Jacob
However, in your example, the "Sort and Filter" buttons in the ribbon bar still remain blank, even when the cursor is placed in a textbox on the subform. Are you seeing this on your end?
~Jacob
Yes - I am seeing the greyed out buttons.
The solution I suggested was meant as an alternative to the built-in filtering on the ribbons.
The solution I suggested was meant as an alternative to the built-in filtering on the ribbons.
ASKER
How can I restore functionality to the built-in filtering on the ribbons?
Actually, I'm thinking having this in two forms is more hassle than it's worth. Perhaps it would be better to have all on one form - it's really only cosmetic anyway...
Actually, I'm thinking having this in two forms is more hassle than it's worth. Perhaps it would be better to have all on one form - it's really only cosmetic anyway...
ASKER
Having the built-in filtering on the ribbons is very useful.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ahhhhh..... Thank you!!!
Is your subform bound or unbound?
Filter by Form will not work on unbound forms... but it does work on *bound* subforms. The default buttons will appear enabled if you click on any bound control in your subform.