View Single Post
  #2  
Old November 16th, 2008, 06:44 PM posted to microsoft.public.access.tablesdbdesign
tina
external usenet poster
 
Posts: 1,997
Default Serial one-to-many tables

well, you're on the right track. i'd add a few supporting tables, and
rearrange a couple of the others a bit, as

tblPatients
PatientID (primary key)
LastName
FirstName
okay so far, except note that i changed the table name and primary key
fieldname, to be more descriptive. keep in mind that Access is not a secure
repository for sensitive data such as social security numbers; if you need
to keep that sort of data, you should look at using a server-based solution
such as SQLServer. also, your use of the word patients indicates human
medical data. if that's correct, and if you're in the USA, your data
storage/handling solution needs to be HIIPA-compliant; again, data security
is an issue here.

tblProcedures
ProcedureID (pk)
ProcedureName
this would be a list of all procedures that you can perform, and nothing
else. do NOT include any fields that indicate a specific person or a
specific performance of a procedure.

tblLocations
LocationID (pk)
LocationName
this would be a list of all locations where an instance of a procedure may
be performed, and nothing else.

tblSamples
SampleID (pk)
SampleDescription
this would be a list of all possible sample descriptions - or names, if
that makes more sense to you - such as pass1, pass2, pass3, etc. and nothing
else.

tblResults
ResultID (pk)
ResultDescription
this would be a list of all possible result descriptions - or names - such
as pos, neg, non-diagnostic, etc. and nothing else.

tblPatientProcedures
PatProcID (pk)
PatientID (foreign key from tblPatients)
ProcedureID (fk from tblProcedures)
ProcedureDate

the table relationships a
tblPatients.PatientID 1:n tblPatientProcedures.PatientID
tblProcedures.ProcedureID 1:n tblPatientProcedures.ProcedureID
make sure you set the relationships in the Relationships window, and
enforce referential integrity.

tblPatProcLocations
ProcLocID (pk)
PatProcID (fk from tblPatientProcedures)
LocationID (fk from tblLocations)
Sequence

the relationship is:
tblPatientProcedures.PatProcID 1:n tblPatProcLocations.PatProcID
tblLocations.LocationID 1:n tblPatProcLocations.LocationID
ditto above re setting relationships.

tblLocSamples
LocSamID (pk)
ProcLocID (fk from tblPatProcLocations)
SampleID (fk from tblSamples)
ResultID (fk from tblResults)

the relationships would be:
tblPatProcLocations.ProcLocID 1:n tblLocSamples.ProcLocID
tblSamples.SampleID 1:n tblLocSamples.SampleID
tblResults.ResultID 1:n tblLocSamples.ResultID

exactly how you set up your data entry form is determined partly by the work
flow, partly by the media that you'll be entering data from (i'm assuming a
sheet of paper with data organized in a particular order), and partly on
your skill level. the work flow you indicated below; and your skill level
can be increased to meet your development needs - trust me, it can the
source media we can't see, so you'll have to use your best judgment on
making the form suit your needs there.

i might start with a mainform, bound to tblPatients. probably an unbound
combobox control in the form's Header section, RowSource: tblPatients, to
select a particular patient record. perhaps a tab control, with the patient
fields on the first page.

then a subform on the second page of the tab control, bound to
tblPatientProcedures, SingleForm view, with a combobox control bound to
field ProcedureID, RowSource: tblProcedures, to pick a procedure when adding
a new record and display the procedure name of existing records.

then a 2nd level subform, bound to tblPatProcLocations, with a combobox
control bound to LocationID, RowSource: tblLocations, again to pick or
display a location. if i were using A2000 - A2003, i'd set the DefaultView
of the level2 subform to Datasheet. then i'd add a level3 subform, bound to
tblLocSamples, DefaultView also as Datasheet, with a combobox control bound
to SampleID, RowSource: tblSamples, and another combobox bound to ResultID,
RowSource: tblResults. (if you're using A2007, i don't know what options may
be available; if you're using A97, a different method is needed - but let's
not go there unless we have to.)

so you open the form, add a patient record or find an existing one in the
combobox in the form Header. click on the 2nd tab, and add or go to a
procedure record (you can use an combobox here, too - or a listbox - to find
a specific procedure record for the selected patient). then enter or go to a
location record in the datasheet, and enter or edit sample records in the
subdatasheet of each location record.

hth


"CuriousMark" wrote in message
...
I need help with design of a database I am writing to keep track of
procedures that I do on patients. For each patient, one or more procedures
can be done. For each procedure, one or more locations can be sampled (I

want
to keep track of the sequence of locations sampled, i.e. 1, loc2R; 2,

loc2L;
3, loc7; etc). For each location, one or more samples (pass1, pass2,

pass3,
etc.) can be taken. For each sample there is a result (pos, neg,
non-diagnostic).

I keep getting lost trying to create a form or sequence of forms that will
enable me to enter all the data. It seems that I need a subform
(Location:Result) inside a subform (ProceduLocation) inside another
subform (Name:Procedure). On the highest level form (Name) I want to be

able
to select from the existing names (shown as LastName & ", " & FirstName)

or
enter a new name. Any help with fixing my database design would be much
appreciated. Thanks.