473,769 Members | 6,267 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7291
Hi Richard,
IMHO, this hould be done using 3 related tables.

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

tblSubCategorie s
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
sbfSubCategorie s
sbfItems
--
HTH,
Don
=============== ==============
E-Mail (if you must)
My*****@Telus.n et

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*****@comcas t.net> wrote in message
news:70******** *************** ***@posting.goo gle.com...
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
5617
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 memory increases, new ROM chips will be built with lookup tables hardcoded into them. Here is an example of what using a lookup table can do for you. The following program divides to integers from 0 to 4 using lookup tables and times itself...
9
7031
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 lookup tables are not likely to change. Question 1: Should I include them in the backend (with rest of data) or the frontend?
3
2922
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 reading about it on google, but there is something I still don't understand, and I'm hoping someone will be willing to explain it to me in small words. Let's say I have a table for addresses, and it includes a field for state. What I would...
3
10665
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 that are hard to find. The main problem I am having right now is that I have a report that is sorted by one of these lookup fields and it only displays the record's ID number. When I add the source table to the query it makes several records...
10
3816
by: junky_fellow | last post by:
what are lookup tables ? How can they be used to optimise the code ?
4
4620
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 bound to a table as a lookup, drawing values from another table to populate the available selections. This all worked fine in VB6. I have distilled the problem down to a simple form drawing data from the Northwind database for a representative...
3
2290
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 than the key value that are stored in the table. It works well if the comboboxes are selected when the row is created.
34
12605
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 ComboBox 3's choice For Instance these are the combo boxes
1
3723
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 query of another lookup table, this correctly displays in a dropdown the values i want for that field. However, in the front end the dropdown for this field is blank, when i try to view the table in design mode to set the rowsource i get the
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7409
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5299
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.