SQL query / DB design question, Access 2002

Status
Not open for further replies.

mikebaz

Ars Centurion
342
Subscriptor
OK, I'm still learning SQL and database design, so let me give you the problem, then the solutions so far, and hopefully the right answer will be obvious to someone. It's a bit long, I apologize in advance for that.

First, the problem. I'm writing an MS Access app (Access 2002, Jet engine at the moment but could go to MSDE if absolutely necessary, would rather not because right now telling him to mail MDB's back and forth is about the level he can deal with for replication) for a friend who runs races (e. g. 5K runs, Triathlons, etc.). Last year's version had a master entry table "RaceEntries", with three columns (PersonID1, PersonID2, PersonID3) for the entrants in each entry. These were foreign keys to a person table. This worked, but was a bit of a pain, because questions like "show me all the races for person ID 13" required checking three columns, as did "find me the entry for Smith, John for this race". So, I decided to change this to have a separate table "RunnerEntries", linking EntryID to PersonID and a Position column indicating if the link was for the first, second, or third entrant. (Most entries are one person, some are 2-person teams, few are 3-person. Last year was about 1,600 entries, 100 2-person teams, 15 3-person teams.) I would like to have a query which returns the old-style view of the entries, so it would join the RunnerEntries and RaceEntries tables. Example:

Old view (truncated):

EntryID 12
PersonID1 18 -> Smith, John in People table
PersonID2 21 -> Jones, Bob
PersonID3 Null -> two person team
<other data>

New tables:

RaceEntries:

EntryID 12
<other data>

RunnerEntries:

RowID 99
EntryID 12
PersonID 18
Position 1

RowID 100
EntryID 12
PersonID 21
Position 2

Now, my questions:

1) This seems like a better way to set up the tables, is that a valid statement?

2) What is the easiest way to get the old view out, if possible? This would hopefully allow use of existing forms/reports while getting to this new design.

3) Is there a better way to do this even still from a design standpoint? (I know, "don't use Access", but it's inexpensive and I can do bug-fixes on the fly; if that wasn't an issue I'd just use full VB or Delphi or something.)

4) What is the most intelligent way to set up the data entry form so that it can be used in this scenario? For the old structure, the people were entered in three bound dropdowns, but now it would have to be more complicated, no? Or would the view be writable?

Thanks!
 
Status
Not open for further replies.