Mike Mattys
mmattys at rochester.rr.com
Thu Mar 5 08:36:32 CST 2009
IIRC, in the Access 97 Viewable Addins, they use a table to list different strings that might apply to a function that takes parameters. An ID associated with each record is called to get the desired string. - Michael R Mattys MapPoint and Database Dev www.mattysconsulting.com - ----- Original Message ----- From: "jwcolby" <jwcolby at colbyconsulting.com> To: "Access Developers discussion and problem solving" <accessd at databaseadvisors.com> Sent: Thursday, March 05, 2009 9:21 AM Subject: [AccessD] Filtered combos > 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 > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com