473,385 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

adding multiple categories to a table with products...

I need help with a tricky questions which I belive have a simple
solution? For those who know Nwind.mdb, the example database that
comes with microsoft access, it has several different tables. One of
them is categories. What I need to do is somehow make it possible for
a product to be listed in several categories. However, I do not know
how to do this. Does anyone have a clue??? Any help is appreciated!
Nov 12 '05 #1
4 4516
On 27 Jan 2004 10:45:23 -0800, er**@freestyletravel.no (Erik Thorsen) wrote:
I need help with a tricky questions which I belive have a simple
solution? For those who know Nwind.mdb, the example database that
comes with microsoft access, it has several different tables. One of
them is categories. What I need to do is somehow make it possible for
a product to be listed in several categories. However, I do not know
how to do this. Does anyone have a clue??? Any help is appreciated!


What you are talking about is called a Many-to-Many relationship (M-M). Each
product can have several categories, and each category can belong to several
products.

The way an M-M relationship is modeled is by making a 3rd table called a
junction table. Generally, the junctino table has a compound primary key
including fields that are foreign keys to each of the other 2 tables.

tblProducts
--------
* ProductID
...

tblCategories
----------
* CategoryID
...

tblProductCategory
------------------
* ProductID
* CategoryID

Now, from each of the original tables, create a 1-M relationship to
tblProductCategory on the matching field names. Each record in
tblProductCategory now represents a valid association of a product to a
catagory.

To model this in the user interface, create a Product form with a subform for
tblProductCategory, and use ProductID as the Master/Child link field. Make a
combo box in the subform for CategoryID that looks up from tblCategories.
Now, each row in the subform indicates a category for the product showing in
the master form, and you can add them just by selecting from the combo in the
blank new row space at the bottom of the subform or delete them by deleting
rows from the subform.
Nov 12 '05 #2
Hello Steve!!

Thanks a lot. This has helped me a great way on the road to success!!!
However, I still have one problem. When I create the subform and add the
combo box, I use the standard wizard helping me to make everything
correct. Here is what I do:
I choose that I want the combo box to look up values from a table.
I choose the table Categories
I add the field cName ( for category name, in other words, a category
like Husky Tour)
Then I choose to hide column key
Finally I choose remember value for later use.
I use cName for label on the combo box.
When I do this I am able to select Husky Tour from my list but no new
combo box pops up upon selection. So it seems I can only choose one
option.....
Any ideas on how to fix this??? You have already saved me 10-20 hours
and I really appreciate any help you or anyone else can give me! Thanks!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3
On 28 Jan 2004 21:49:09 GMT, Erik Thorsen <er**@freestyletravel.no> wrote:
Hello Steve!!

Thanks a lot. This has helped me a great way on the road to success!!!
However, I still have one problem. When I create the subform and add the
combo box, I use the standard wizard helping me to make everything
correct. Here is what I do:
I choose that I want the combo box to look up values from a table.
I choose the table Categories
I add the field cName ( for category name, in other words, a category
like Husky Tour)
Then I choose to hide column key
Finally I choose remember value for later use.
I use cName for label on the combo box.
When I do this I am able to select Husky Tour from my list but no new
combo box pops up upon selection. So it seems I can only choose one
option.....
Any ideas on how to fix this??? You have already saved me 10-20 hours
and I really appreciate any help you or anyone else can give me! Thanks!


Is your subform set to Continuous?
Nov 12 '05 #4
Yes, my subform is set to continous. So I really don't know what is
wrong with it. Are there any other settings I should take into
consideration? I am sorry about bugging you with these probably too easy
questions but I can't figure it out even though I have looked and
searched a lot of places!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ralph Guzman | last post by:
TASK: I have to generate a report with all categories, subcategories and products in database. PROBLEM: I want to write one query that will return: 1. category 2. subcategory: determined by...
6
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to produce a form to add products to a table (new...
6
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to produce a form to add products to a table (new...
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.