Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


How should I organize categories and their territory rates into Access tables?

Posted on 2016-08-30
Medium Priority
Last Modified: 2016-08-30
I don't know why, but I've been staring at this problem for a while now and I can't see it clearly.  Could someone please help me figure out how to set up the Access tables for this type of data?

I need users to be able to pick a Specialty Class, then pick a Location to find the Rate.  Each location is associated with a particular Territory.  Each Territory has a given Rate for each Specialty Class.  

For example,
   I have Locations: AL in T1, TX in T1, OK in T1, CA in T2, LA in T2, NY in T2, OR in T3, WY in T3, NC in T3, etc.
   I have Specialty1, Specialty2, Specialty3, etc.
   I also have Specialty1 T1 Rate, Specialty1 T2 Rate, Specialty1 T3 Rate, Specialty2 T1 Rate, etc.

I've tried combinations of tables ranging from 2 to 4.  But I can't seem to come with something logical that will allow the user to pick the Specialty Class, pick the Location, and then view the Rate (or drop the rate into a calculation).

Any ideas of how this is normally done?

Question by:fabi2004
  • 6
  • 4
  • 3
LVL 26

Assisted Solution

Nick67 earned 1000 total points
ID: 41777163
Start here
Go through it all.

Now, stop thinking about the users and the UI for a bit and think about the data.
What stuff is fully independent?
There are territories.
There are locations.  Each location belongs to one and only one territory
There are Specialty Classes.
There are rates.  Each rate depends upon a specialty class and upon a territory.

Four tables.
Likely, once you get them built with their relationships that you'll want to have three cascading dropdowns.
There's a Territories one.  It cascades to limit the choices for a Location one.
The Territory one cascades to limit the choices for the Specialty Classes, too.
Choose the Specialty Class, and the related rate can then be displayed.

But you may have gone awry in not thinking about picking the territory.
The territory is what limits the choices of locations, and specialty classes.
Those two things then determine the rate.
LVL 85
ID: 41777172
Does the combination of a specific Specialty + Location determine the Rate? And you want the user to select a Specialty, and then a Location, and you would then want to lookup the Rate?

Is a specific Rate dependent on the Specialty + Location? In other words, if I have a Specialty of XX, is the rate different for LocationA versus LocationB? Or is it different for TerritoryA versus TerritoryB?

Might help if you could provide some sample data (obfuscated, of course).

Author Comment

ID: 41777189
Scott, each Territory + Specialty has a Rate.  There are only four territories and each of them contains many parts of the country.  A user wouldn't automatically know the territory, but they would know the specialty category and the location which they could use to look up the territory.  Then, the territory + specialty combination would pinpoint the rate.

Thank you Nick.  I'm going to look through that and try it.

The sample data I have is in an Excel workbook.  The workbook calculations need to become a part of the database I'm building.  Should I upload the workbook?
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 41777204
OK Nick, I was thinking four tables at one point also.  But 2 of the four tables will only have a column, two at most.

For example, the Territory table only needs a PK with territory numbers 1-4.  Nothing else.  

The Specialty Classes table doesn't need anything other than a PK (probably autonumber) and the SpecialtyClass description.

So, when I go with four tables, I feel like I'm adding unneeded complexity.  However, when I go with two tables, tblLocations and tblRates, I end up with a many-to-many relationship based on Territory.

Trying with 3 tables, tblLocations, tblRates, tblTerritories confuses me on looking up the rate.

BTW...a user would not automatically know the territory.  They would know the location and that would need a lookup for territory.  Also, each specialty has a rate for each territory.  So specialty 1 territory 1 = UniqueRate, Specialty 1 Territory 2 = UniqueRate2

Sometimes it seems so hard to explain things verbally (or in written form in this case) :-)
LVL 85

Accepted Solution

Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1000 total points
ID: 41777213
So a Location would belong to one and only one Territory?

If so, then something like this to start off:





The user would select a Specialty and a Location, and you could then use something like this to get the Rate:

SELECT * FROM tTerritory_Rates AS tr INNER JOIN tLocation loc ON tr.Territory_ID=loc.Territory_ID
WHERE tr.Specialty_ID=" & SomeSpecialtyIDValue & " AND loc.ID=" & SomeLocationIDValue

Author Comment

ID: 41777228
Alright, that was basically my four table setup other then the rate name, which doesn't exist.  So you think this is the best way to set it up?  When I looked at it, it seemed I was creating extra table with little to no data in them.  But then, when I tried to combine some data into fewer tables, I ran into more complexity when looking up the rate.
LVL 85
ID: 41777243
You don't have to create lookup tables (the Territory and Specialty tables, for example), but in general it's a good idea to do so. Without those types of tables you would find it difficult to add new Territories or Specialties - and you'd also find it difficult to create reports when you get to that phase of the project.

And you shouldn't really be concerned with the number of tables, but rather whether those tables are correctly structured. Given the information provided, it would seem the structure I suggested would be a good starting point. That doesn't mean it's the best (or even the right) structure - but it's just a common structure for the business processes you've explained.

Author Comment

ID: 41777248
Excellent.  I feel better moving forward with it like this.  I so much appreciate both of you for helping me.  Thank you so much.

Author Closing Comment

ID: 41777252
Thank you Nick.  Than you Scott.
LVL 26

Expert Comment

ID: 41777294
OK Nick, I was thinking four tables at one point also.  But 2 of the four tables will only have a column, two at most.

When you start to think about it, you may START with only one or two columns -- but good data has a tendency to grow.

Take Territory.
It will have an ID
Probably a friendly name
It was created by somebody
It was created on a certain date
It can have a notes field so you can write some stuff about how and why that territory came to exist
It can have an date last edited field ( maybe one state moves from one territory to another based on workload or distributions centers or something)

Locations may be similar

Take rates (I take it prices)
Those get really tricky.
Who created them, where they applied, start times and end times that they were in effect are just some of the things you may want to record.

Lots of data can add up quickly when you start to put it into production and track changes!
But if you get a good, solid normalized data setup going FIRST extending it later is much easier.
Take a shortcut early and you comes to painfully regret it later.
LVL 26

Expert Comment

ID: 41777301
BTW...a user would not automatically know the territory.  They would know the location and that would need a lookup for territory.

Good enough.  You can create a flat listing of locations -- but don't sell the users short, or forget about good UI design.  
1. If you give the territory a friendly name, and choosing it shortens up the list of locations, the user won't take long to know what territory they are in.
2. Humans--and comboboxes -- are visually good with about 30 things in a dropdown listing.  If you have a lot more than 30 locations, having the user select a territory first so that the location dropdown has a lot fewer items in it makes their lives much easier.  Hunting for something at the bottom of a long combobox dropdown when you are not a typer stinks and is not efficient design.

Thank you Nick.  Thank you Scott.
You're welcome.

Author Comment

ID: 41777312
Thank you so much for the explanation.  Everything makes perfect sense.  I appreciate your time.
LVL 26

Expert Comment

ID: 41777329
You're welcome.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have had my own IT business for a very long time. I started mostly with hardware and after about a year started to notice a common theme. I had shelves with software boxes -- Peachtree, Quicken, Sage, Ouickbooks -- and yet most of my clients were…
Beware when using the ListIndex and the Column() properties of a listbox in Access 2007.  A bug has been identified in the Access 2007 listbox code which can cause the .ListIndex property to return a -1, and the .Columns(#) property to return a NULL…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question