I have a database I’m working on designing using Access 2007 and I’m wondering what the best way to accomplish the following would be.
I have four tables:
- Injury
- Treatment
- Invoice
- Payment
I want there to be zero, one or more Notes entries for each of these table entries.
Obviously, I could do this:
- InjuryNotes
- TreatmentNotes
- InvoiceNotes
- PaymentNotes
But I’d prefer to do this:
- Notes
But I’m stuck as far as how to do the referencing. Do I need to consider a lookup table?
- Notes
- NotesLookup
So that I can have…
- Injury
- InjuryID …
- Treatment
- TreatmentID …
- Invoice
- InvoiceID …
- Payment
- PaymentID
- Notes
- NotesID
- Note
- NotesLookup
- TableName
- ID
- NoteID
Is this the best way to do it in Access? Is there a better/more natural way, especially one that allows me to rely on the in-built way that Access would handle the save/derefencing (so I don’t have to code up a VBA solution)?
I suppose I could eliminate the NotesLookup table and merge TableName and ID into Notes. At this stage, I’m just wondering how I’m going to save that information and how I’m going to dereference on view.
Go with the “obvious” approach of 4 notes tables:
Since these model separate entities that seem to have a specific meaning. That is, you wouldn’t store injury notes in the same place that you would store treatment notes in the real world, which you are modeling, would you?
This design also ensure that when querying for these you don’t have to use either magic numbers or an extra join on the notes lookup table you are suggesting.
Additionally, if any of the notes tables needs to change (additional data that needs to be captured with each note of a specific type, for example), the change will not have an impact on the other note types.