[AccessD] Filtered combos

jwcolby jwcolby at colbyconsulting.com
Thu Mar 5 08:21:47 CST 2009


Have you ever wanted to be able to display a full set of data in a combo, but only allow a subset of 
the data when selecting data for a new record?  In other words let's say that you have a form that 
displays a field for contracts.  Some records have old contracts, but when entering new data the 
user should only select active contracts.

The normal way of doing this is to have two different queries for the combo.  One query is 
unfiltered, and the combo loads that when the form loads.  However as the combo gets the focus, the 
combo's OnFocus event handler will place a filtered query name in the combo's RowSource.

This functionality is perfect for adding to the combo class.  By adding a new property to hold the 
filtered query name (or SQL statement) the clsCtlCbo can sink the OnGotFocus and OnLostFocus, 
swapping out the queries as required to give you this functionality.

Comments before I write the lecture?

-- 
John W. Colby
www.ColbyConsulting.com



More information about the AccessD mailing list