[AccessD] Two “Related” List Boxes on a Single Form

jwcolby jwcolby at colbyconsulting.com
Sun Aug 29 19:49:24 CDT 2010


If you only do this once, then the code you have is fine.  If you do it over and over in form after 
form (or on one form) then a class to wrap the two combos works great.  The class can sink the 
events and when comboA changes it requeries comboB.

John W. Colby
www.ColbyConsulting.com


Brad Marks wrote:
> I have just started to experiment with Parent-Child List Boxes on a single
> form.  I have developed a method that works, but I would like to know if I
> am on the right track.   Perhaps there is a better method that people with
> more experience use.
> 
> 
> 
> For experimentation purposes, I am using a simple example.
> 
> 
> 
> The Parent List Box is set up for “Country” – Only two countries are in it,
>  “Canada” and “US”
> 
> 
> 
> The Child list box is set up for Provinces/States
> 
> 
> 
> 
> 
> I have set up this function
> 
> ~~~~~~~~~~~~~~~~~~~~~~
> 
> Global Country_Selected
> 
> 
> 
> Function Function_Country_Selected()
> 
> 
> 
> Function_Country_Selected = Country_Selected
> 
> 
> 
> End Function
> 
> ~~~~~~~~~~~~~~~~~~~~~
> 
> 
> 
> 
> 
> In the Parent List Box there is a  “On Click” Event Procedure with this code
> 
> 
> 
> Country_Selected = List0
> 
> 
> 
> (Plus code to Requery the Child List Box)
> 
> 
> 
> ~~~~~~~~~~~~~~~~~~~~~
> 
>  In the Criteria in the Query for the Child List Box I have this line
> 
> 
> 
> Function_Country_Selected()
> 
> 
> 
> ~~~~~~~~~~~~~~~~~~~~~
> 
> 
> 
> Again, this method seems to work.  I am just curious if this is the approach
> that others use, or is there perhaps a better method.
> 
> 
> 
> Thanks,
> 
> Brad



More information about the AccessD mailing list