473,395 Members | 1,791 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,395 software developers and data experts.

Subcategory lookup tables

I want to create a table where the first field is a category, the
second field is a subcategory to the first field, and the third field
is a subcategory to the second. E.g., the category table might look
like this:

Toys
Jewelry
Sporting Goods

The second field lookup table might be:

Toys Board Games
Toys Video Games
Jewelry Watches
Jewelry Rings
Sporting Goods Baseball Gloves

And the third field table might be:

Board Games Monopoly
Board Games Risk
Board Games Othello
Video Games The Sims
Video Games Madden NFL
Watches Seiko Chrono
Watches Timex Ironman

So, if the user entered [Toys], the second field would be a lookup of
[Board Games / Video Games]. Likewise, entering [Video Games] would
give a lookup of [The Sims / Madden NFL] for the third field.

What's the best way to do this? I'd like to have a Datasheet format.
I've thought of a couple designs, but my designs seemed like hacks,
with VBA queries writing to temporary scratch tables based on the
contents of the fields. I'm sure there's a more elegant approach. If
someone could pass it along it would be very much appreciated.

Thanks,
Rich
Nov 13 '05 #1
3 7212
Hi Richard,
IMHO, this hould be done using 3 related tables.

tblCategories
CatID - AutoNumber - PK
Category - Text
.... other fields

tblSubCategories
SubID - AutoNumber - PK
CatID - Long Integer - FK
SubCategory - Text
.... other fields

tblItems
ItemID - AutoNumber- PK
SubID - Long Integer - FK
Item - Text
ItemDetails - Memo?
.... other fields

Relationships
1 ==>M Categories to SubCategories
1 ==> M SubCatagories to Items

Viewing / entering of data would be via a maniform / dual subform
frmCategories
sbfSubCategories
sbfItems
--
HTH,
Don
=============================
E-Mail (if you must)
My*****@Telus.net

Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code
samples are also Access97- based
unless otherwise noted.

Do Until SinksIn = True
File/Save, <slam fingers in desk drawer>
Loop

================================

"Richard Coutts" <rc*****@comcast.net> wrote in message
news:70**************************@posting.google.c om...
I want to create a table where the first field is a category, the
second field is a subcategory to the first field, and the third field
is a subcategory to the second. E.g., the category table might look
like this:

Toys
Jewelry
Sporting Goods

The second field lookup table might be:

Toys Board Games
Toys Video Games
Jewelry Watches
Jewelry Rings
Sporting Goods Baseball Gloves

And the third field table might be:

Board Games Monopoly
Board Games Risk
Board Games Othello
Video Games The Sims
Video Games Madden NFL
Watches Seiko Chrono
Watches Timex Ironman

So, if the user entered [Toys], the second field would be a lookup of
[Board Games / Video Games]. Likewise, entering [Video Games] would
give a lookup of [The Sims / Madden NFL] for the third field.

What's the best way to do this? I'd like to have a Datasheet format.
I've thought of a couple designs, but my designs seemed like hacks,
with VBA queries writing to temporary scratch tables based on the
contents of the fields. I'm sure there's a more elegant approach. If
someone could pass it along it would be very much appreciated.

Thanks,
Rich

Nov 13 '05 #2
Rich,

start here...
http://www.mvps.org/access/forms/frm0028.htm

then adapt as you get each piece working.
Nov 13 '05 #3
> start here...
http://www.mvps.org/access/forms/frm0028.htm


Thanks for the tip. I created a saved Query that populates the
contents of second combobox list by executing a Requery in the
AfterUpdate event of the first combobox. It worked great except for a
hitch -- because I have a datasheet, I'm winding up with all records
being modified when the AfterUpdate Requery executes, when I only want
the current record to be modified.

E.g. If my list is

Board Games Monopoly
Watches Seiko Chrono
Board Games Othello
Watches Timex Ironman

And AfterUpdate Requery fires when I edit the first line, the table
ends up looking like:

Board Games Monopoly
Watches
Board Games Othello
Watches

Likewise, if I edit the second line, the AfterUpdate Requery fires for
all records and I get

Board Games
Watches Seiko Chrono
Board Games
Watches Timex Ironman

Is there a way to keep the Query local to the current record?

Thanks,
Rich
Nov 13 '05 #4

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

Similar topics

2
by: CoreyWhite | last post by:
The future of computer architecture will use lookup tables. Currently computer processor speed outweighs the benefits of using computer memory for lookup tables, except in some cases. As computer...
9
by: Koen | last post by:
Hi all, My application uses a lot of lookup tables. I've splitted the frontend (forms, reports, etc) from the backend (data). The database has around 10 different users. The values in the...
3
by: my-wings | last post by:
I've been reading about how evil Lookup fields in tables are, but I've got to be missing something really basic. I know this subject has been covered before, because I've just spent an hour or two...
3
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
10
by: junky_fellow | last post by:
what are lookup tables ? How can they be used to optimise the code ?
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
3
by: dbuchanan | last post by:
Hello, (Windows forms - SQL Server) I fill my datagrid with a stored procedure that includes relationships to lookup tables so that users can see the values of the combobox selections rather...
34
gcoaster
by: gcoaster | last post by:
Hello Everyone! I have a question regarding "cascading combobox(s) list(s)" I would like: ComboBox 2 to show results from ComboBox 1's selection, then ComboBox 4 to show results from...
1
by: paulquinlan100 | last post by:
Hi Im having problems getting a column in one of my tables to display the lookup values correctly. The database is split, in the backend the rowsource for this particular field is set to a...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.