Connecting Tech Pros Worldwide Help | Site Map

limiting values in a list box that is based on another list box

wcrackshot78
Guest
 
Posts: n/a
#1: Mar 12 '06
I currently have three list boxes on my form, the information on each
one is determined on what was selected on the one before it. The
problem I'm having is the information that is used is pulled from
another program and is duplicated a lot.

Example

Type Make Model

Car Ford Mustang
Car Ford Focus
Car Dodge Neon
Truck Ford Ranger
Truck Ford F-150


In the first list box it would allow you to pick from Car or Truck, the
second list box would make you pick from Ford or Dodge, the problem I'm
running into is that Ford will come up twice in the list box and Dodge
once, I would like to limit it to only come up once. The code I'm
using in the row source for the list box is as fallows.

SELECT Products.ProductID, Products.Type, Products.Make FROM Products
WHERE (((Products.Type)=Forms![Bound Combo Form]!LstType)) ORDER BY
Products.Make;

This is not the information I'm actually using just an example. Any
help anybody could give me in limiting duplicate entries would be
greatly appreciated.

baonks@gmail.com
Guest
 
Posts: n/a
#2: Mar 12 '06

re: limiting values in a list box that is based on another list box


i think u should make 3 query for ur problem

1. group by type
2. query where type car = first input
3. query where type car = first input, and where make = second input

hope this help u

Hansen
Guest
 
Posts: n/a
#3: Mar 12 '06

re: limiting values in a list box that is based on another list box


Hi

Use SELECT DISTINCT in your query. It would work better to have 3
seperate queries:
For the 1st Listbox:
SELECT DISTINCT Products.Type FROM Products
WHERE (((Products.Type)=Forms![Bound Combo Form]!LstType))
For the 2nd Listbox you will select all makes that match the 1st query
For the 3rd Listbox you will select all nakes that match the 1st and
2nd query.

Closed Thread