Results 1 to 6 of 6
  1. #1
    medtech2 is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    2

    Help with Table Structure

    I'm trying to set up a database that lists laboratory test results. One particular test we perform detects almost 200 different analytes. A patient can have any particular number of these analytes present in his/her blood at one time, and our patients are tested repeatedly over time. I have a couple related tables: one with all of my patient identifiers, another one with specimen specific info, and a third one specific to this test, with fields that include the PK of Screen_ID, Sample_ID (relates back to the specimen table), and Test_Date (each sample can be tested multiple times). I'll eventually need to be able to run a query to see which patients had a particular analyte present (or a query to look for a bunch of analytes at once). So what is the best way to structure my database to include the info for this test? Do I set each analyte as a separate field within the third table, with the option of choosing "yes" or "no", it is present? Or does this need to be set up a fourth table somehow?
    Thanks in advance!

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Here is a document on database design.
    http://forums.aspfree.com/attachment...achmentid=4712

  3. #3
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    I would create a table, tblAnalytes, that hold all the analytes and an identifier (PK) for them. So 200 records of 2 fields. Then I would create a table, tblTestAnalyte, that facilitates a many-to-many relationship between the test table and tblAnalytes. The test table holds data unique to the test. the tblTestanalyte has a record for each analyte present in the test. If Analyte A, C, and D are present in test 1246, your entry in tblTestAnalyte would look like:
    TestAnalyteID, TestID, AnalyteID
    1, 1246, A
    2, 1246, C
    3, 1246, D

    You can then query this table to find how many analytes are found per test by,
    SELECT TestID, Count(AnalyteID) AS CountOfAnalytes
    FROM tblTestAnalyte
    GROUP BY TestID

    you can also have a WHERE clause that links to a form that will give you the count for just a single test.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    A major concept you should glean from Shabz suggestion is that the multiple yes/no fields is not a good idea.

    Here is another reference to supplement orange's http://forums.aspfree.com/microsoft-...es-208217.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    medtech2 is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2011
    Posts
    2
    Thanks for your responses. I'm not sure they've given me what I needed though (but I'm somewhat new to Access so maybe my solution is very simple and I just am overthinking it). If this test only checked for a handful of things, I would just put them in a list box under the Screen_ID table, but that seems inappropriate when there are 200 possibilities. That is the part that is confusing me. But I need to build it so that people can just check off what is present (it would be a disaster if people had to type the results in for every sample).

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I see two options for entering the relevent Analytes.

    1. A Continuous view form bound to tblTestAnalyte (possibly a subform, synchronized to main form bound to tblTests) with a combobox to select an Analyte for each record for as many records needed for each test.

    2. An unbound form with 200 checkboxes, one for each analyte. VBA code would save record for each checked box. Forms have a limit on how many controls they can have. I have some rather densely populated forms and reports, so the limit is high, but I have hit it. My workaround was to use subform/subreport.

    Tables and queries have a limit of 255 fields. This is only one reason multiple similar fields (like the yes/no's) is impractical. Another is the difficulty of doing the type of queries you desire.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Table Structure
    By riley73 in forum Database Design
    Replies: 5
    Last Post: 05-03-2011, 07:13 AM
  2. Table Structure
    By megabrown in forum Database Design
    Replies: 1
    Last Post: 11-18-2010, 04:12 AM
  3. Copy Table Structure (only) Problem
    By homerj56 in forum Access
    Replies: 1
    Last Post: 07-16-2010, 10:36 AM
  4. Complex Survey: Table Structure Design and Normalization
    By kevin007 in forum Database Design
    Replies: 2
    Last Post: 07-06-2010, 09:21 AM
  5. An import question above the table structure
    By Shag84 in forum Import/Export Data
    Replies: 2
    Last Post: 08-20-2009, 12:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums