Query for ComboBox - Show each entry only once

G

Guest

I have a table of categories with Primary Category and Secondary Category and
Category ID. Category ID is one to many with Product Table. Primary
Category has 4 entries that are reentered for around 8 subcategories. I
would like to use a dropdown menu combobox in a form to input the Primary
Category. Is it possible to query the table for each unique entry in that
field, or do I need to separate my category table into two tables? (I have
been using a value list, but now I want to have a subform to add a category
and any changes to the category table won't be reflected in the value list.)
 
T

Tom Ellison

Dear McLitle:

In your table of categories, you have multiple rows with the same Primary
Category value? Is that a good thing?

Of what entity is this a table?

Is there a reason you do not have a table of Categories (or Primary
Categories) in which each category is placed only once?

Tom Ellison
 
G

Guest

Not every Primary Category has a Secondary Category so when I built the
database, I just created one Table. CategoryID (one to many to Product
Table) Primary Category with a value list and Secondary Category that is
text. This way each combination (even one with no entry into Secondary
Category) would have a CategoryID. Is there query that is similar to the
Auto Filter in Excel? One that I can put in the rowsource for PrimaryCategory
in a form. I have already completed the form so that it looks up the
CategoryID based on the entry into fields PrimaryCategory and
SecondaryCategory.
 
T

Tom Ellison

Dear McLitle:

Do some of the Primary Categories have more than one Secondary Category? If
not, what is the source of the duplication.

A DISTINCT query will do what you want:

SELECT DISTINCT PrimaryCategory
FROM YourTable

Make this the RowSource of the combo box.

The solution to this immediate problem does not eliminate the need for good
table design.

Tom Ellison
 

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