I have couple of primitive ideas to do this job but I wanna see your suggestions guys . They might be much better than mine . I wanna design a database (Access XP) which holds items and subitems .For example:
Category One
-Item1
-Item2
-Item3
-Item4
Category Two
-Item1
-Item2
-Item3
-Item4
Category Three
-Item1
-Item2 (might include multiple subitems)
---Subitem2.1
---Subitem2.2
-Item3
-Item4
Thanks for the reply Ed but I don't think this approach will help me solving my problem since I would have a tree-like subsitems (maybe more than 2 to 6 subitems) . any other options . ?
You could actually do it with just one table but it may be problematic because you'd be referring to items in the same table in relationships. Also Top level items would have no parentID.
Edneeis , you must be right now , but I'm too dumb to strcuture my data . Suppose we have these main Items :
Audio & Video
Players
Add-Ins
Encoders [includes: Wave , MP3 , DVD trees]
...etc
Internet
Download Managers [includes : FTP , HTTP]
Site Rippers
Chat
...etc
Games
Action
Arcade
...etc
Business
Database Management
...etc
I have more than this structure , ramified items . I'm really confused how to apply your approach here . What I did is as follow:
One table for (Main Categories) , One table (Subitems1 ,Subitems2 ,Subitems3) . This was really confusing . I will populate all these in multiple comboboxes . So I think (not sure) I should separate every category from the other .
As a side note if the Category is not a number field you may want to put it in its own table. Especially if there is a chance that it has or will in the have in the future more properties then just a name. How does everyone else work that situation? Would you have Category as a seperate table or just a text field?
My thought in seperating it to a new table are:
-If it will someday have more than just a name
-To avoid spelling mistakes that would differentiate Categories
-To save space, since a number field instead of longer text field would be repeated
Of course it complicits the structure a little and may have a slight adjustment on performance having to query for the name.
Sure you could do it that way although I'm not sure what structure you are using. This is what I was talking about, only with a third table for Categories.
Actually even better, here is the db. If you have Access XP or 2000 or whatever one has the expand/collapse bit so you can drill down the data, then data entry is easy and shows the structure well. If you want all the data together then you can use a query.
Sorry for not replying your post Edneeis but I was busy installing my Satellite Connection . wow. anways , this seems the best solution but I have some questions : How did you make thos tables so they appear with "+" plus sign (like treeview) ? How simple is it to get the all specific category , for example internet ? the whole record down ?
The treeview bit is just part of Access, although you may have to have a relationship for it to do it, not sure. To get a specific category you just query for it either by its ID or some combination thereof. For instance this would get you all Items by CategoryID:
SELECT Items.Item
FROM Categories INNER JOIN Items ON Categories.CategoryID = Items.CategoryID
WHERE Categories.CategoryID)=?
Just Replace ? with the CategoryID (i.e. 2) or a parameter in a query.
Last edited by Edneeis; May 5th, 2003 at 03:14 PM.
This makes it so pro-like . I think I will go for your way Edneeis . Sure I'll try this now , If I have any question , I'll pester you , . Thank you for being patient Ed .