Populate distinct one combo box depending on selection in another combo box

T

Tony Girgenti

Hello.

Having a problem trying to make combo8 show only the field from records
based on the combo0. Combo0, customer, is selected using a drop down.
Combo8 should only select records for customer in combo0 and display the
distinct sidemarks.

It populates the combo8 but has duplicates.

How do i eliminate the duplicates ?

Combobox-b properties has:

RowSourceType=Table/Query
RowSource =SELECT DISTINCT [PENDING ORDERS].[PENDING ORDERSID],
[PENDING ORDERS].SIDEMARK FROM [PENDING ORDERS] WHERE (([COMPANY
NAME]=Forms![CHF - WIP]!Combo0));

Thanks,
Tony
 
J

Jeff Boyce

Tony

If I'm reading your SQL statement correctly, you are asking for distinct
[PENDING ORDERSID] values. Won't each/every pending order have a unique ID?

If you left the [PENDING ORDERSID] field out, I believe you'd be left with
distinct (unique) [SDIEMARK] values.

Regards

Jeff Boyce
<Office/Access MVP>
 
T

Tony Girgenti

Hello Jeff.

When i try this, the sidemark combo8 box is empty.

Thanks,
Tony

Jeff Boyce said:
Tony

If I'm reading your SQL statement correctly, you are asking for distinct
[PENDING ORDERSID] values. Won't each/every pending order have a unique
ID?

If you left the [PENDING ORDERSID] field out, I believe you'd be left with
distinct (unique) [SDIEMARK] values.

Regards

Jeff Boyce
<Office/Access MVP>

Tony Girgenti said:
Hello.

Having a problem trying to make combo8 show only the field from records
based on the combo0. Combo0, customer, is selected using a drop down.
Combo8 should only select records for customer in combo0 and display the
distinct sidemarks.

It populates the combo8 but has duplicates.

How do i eliminate the duplicates ?

Combobox-b properties has:

RowSourceType=Table/Query
RowSource =SELECT DISTINCT [PENDING ORDERS].[PENDING ORDERSID],
[PENDING ORDERS].SIDEMARK FROM [PENDING ORDERS] WHERE (([COMPANY
NAME]=Forms![CHF - WIP]!Combo0));

Thanks,
Tony
 
R

Ron2005

was it empty in the sense of no visible entries but it opened to show
multiple entries.

Since the query has been changed then the bound column and # columns
and width of columns also need to be changed.
 
T

Tony Girgenti

Ron.

When i use the drop down arrow for the combo box, it shows nothing.

What settings should i use for those fields you said need to be changed.
They are currently:
CloumnCount=2
BoundColumn=2
ColumnWidths=0";1"

Thanks,
Tony
 
R

Ron2005

if you only have 1 column in your query then all three of those items
should have a value of 1

ColumnCount=1
BoundColumn=1
ColumnWidths=1" ( or as wide as necessary to see the value.)

Essentially these three items should match your query.
The count says how may columns are returned (in the query)
The bound says which one of these should be shown (this may rather be
which one to load into the data field - My standard use of combo boxes
is to load what is shown - help will probably tell you which it is - or
try it. )
How wide should each of these columns be when you open the box.

Given that your query now has only one returned field, the column width
for the first field is 0 in the code you show.

Ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top