Mike Mattys
mmattys at rochester.rr.com
Thu Mar 5 09:23:54 CST 2009
OK, what I was thinking was that you'd have a global class that is instantiated while the database is open and you'd just call a method in the class with the record number of the string that would be the new recordsource of the combo. - 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 10:13 AM Subject: Re: [AccessD] Filtered combos > Hmmm... I don't have a clue what you are talking about. > > I am discussing a combo box on a form that needs to display a different > dataset when the user is > SELECTING data for a new record, than for when the user is just viewing > all the existing records in > the form. When viewing existing records, the combo needs to display > unfiltered data, but when > adding a new record it needs to filter the selection down in some manner. > > John W. Colby > www.ColbyConsulting.com > > > Mike Mattys wrote: >> 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 >> > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com