New Property, Filter for Combo Box
Scenario: Product Obsolete.
if product is marked as obsolete then we do not want it to appear on the combo drop down list but still must be visible to display historic data.
The Hack involves hiding a second drop down behind the first with a different rowsource, on click of the first we swap focus to the rear dropdown which then retrieves the required value without effecting the bound tables historical data.
Can you apply a filter to a combo box, on focus, for addition of records.
Steve Goldring commented
Where needed I add a UNION to the query to ensure the required item is included
You can change the RowSource at run-time. You can update the SQL to include a where clause.
I have exactly this problem. The users keep changing the relevant values for a codified field each year. I've had to update the code table to have "From" and "To" dates, and update the RowSource of the dropdown to include the row's period in the Form_Current event. If the form is read-only then this doesn't need to happen, of course.
Ben Sacheri commented
I'm adding a suggestion that this feature work in Continuous Forms view, where the filter can vary from row to row.
There are many times this would be handy. As in the example, removing "obsolete" products from the combo row source prevents then being added fine. However in a Datasheet the column now shows as blank for those products that are obsolete!
Yes this is often required!