Restricting Form Data based on ComboBox

ToddNYC

Registered User.
Local time
Today, 07:17
Joined
Sep 24, 2012
Messages
23
Hello - I think I am missing something very basic here and hoping someone can point me in the right direction!

I have a table of several hundred items. Each of these items has a category code to make the data easier to manage. (This category code links back to a separate table. So in the primary table it has cat_code=1, which references tblCategories where cat_code 1 = "Baseball".)

I manage this data with a form. I'd like to add a combobox to the top of the form to allow me to restrict the available data on the form to an individual category code (or all if none selected).

I'm playing around with subforms and am close but it is not working exactly right. The combobox is showing a list of category ID's and not names and it is listing them all many times. (for example it says 98, 98, 98, 98, 98, 12, 12, 12... instead of showing the single text value for 98 and underneath that the text value for 12 -- just one time).

Am I close to figuring this out? Thank you!!
 
Well, normally the combo would have a row source that got selections from a "categories" table, so it would only have 1 record each. To base it on an activity table, you'd either have to use DISTINCT or GROUP BY:

SELECT DISTINCT Category
FROM TableName

SELECT Category
FROM TableName
GROUP BY Category
 
Thank you Paul for the quick reply.
 

Users who are viewing this thread

Back
Top Bottom