By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,984 Members | 2,794 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,984 IT Pros & Developers. It's quick & easy.

Something about combo box

P: 7
Sorry, i didn't know exactly what to name my question.

What i need is to create a database for storing office items that will include Desktop computers, Laptops, printers, phones, etc. as ItemCategories.

I have a combo box on form to list all ItemCategories and run query by Item Category. Then the query result should show all the items, if say ItemCategory was Desktop computers then items returned by query will be all desktop computers.

On the other hand, i have a combo box for the user to choose ItemCategory when they are adding new items to the database. Other fields for adding new items are "Item make" "Item serial No." and "comment".

The experience i had was that each time i would add new item and choose the ItemCategory from the combo box, upon query the ItemCategory will appear in the combo box as many times as i had added new items. What i want is no matter how many times i choose the ItemCategory for new items the query combo box should only show a single ItemCategory afterward.

I hope my question has some sense. Please, advise. A Sample will be appreciated, too.
May 14 '08 #1
Share this Question
Share on Google+
1 Reply


MGrowneyARSI
P: 90
Ok from the start you should have a separate table that stores your Item categories and a lookup in your Items table looking at the Items categories table. it's sounds like that is the way you have it setup if not then what your trying to do may not work. from there create a new combo box looking at your Items category table returning the Item category. then in your query for your form put criteria for item category like so Forms!formname!comboname to restrict by category and also paste it in the field section and put an null in the second line of criteria. then all you have to do is requery your form on the afterupdate event of your new combobox.

if for some reason you don't have a category table then you may try this go into the data for your existing combo and open the query put it in SQL view and place he word DISTINCT after SELECT ( SELECT DISTINCT item, item_code bla, bla, bla FROM items WHERE Bla Bla Bla).

hope this helps
May 15 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.