Results 1 to 5 of 5
  1. #1
    Winter1 is offline Novice
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    5

    create a table for a multiple choice question

    Hi there,

    I am struggling with designing my database:

    I have a table that has 31 fields: they are all locations. Each field has a choice of 11 different activities, from walking, cycling, fishing etc.
    The primary key is my SurveyIDForm.
    If I have a person that does more than one activity in each location, I would have to input that twice. Therefore having two or more records with the same SurveyFormID. I have tried to enforce referential intergrity in my relationships....but this comes up with a problem and it doesn't allow it. If I don't have enforced referential intergrity I think I may end up with orphan records.


    Also it doesn't allow me to have one to many relationship.

    I have another table with this same problem too, although on a smaller scale, I have 2 fields and in the field called ownership I can have 5 different options, ie the person might own a bike, a car etc, but if the person owns two or three different things I would have more than one record, with the same surveyIDform.

    I am not sure how to do this, any suggestions would be great. Once I get this right I will go onto design my forms!

    Thanks

    Winter

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Multiple records associated with same SurveyFormID sounds reasonable. So the question is why can't you enforce referential integrity? Why do you have 31 fields for the same kind of data? This is not a normalized structure.
    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.

  3. #3
    Winter1 is offline Novice
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    5
    So I am not sure why I can't enforce referential integrity and I also agree, but not really sure how to organise the table....31 field for different locations is a pain, but at each location people could be doing more than one activity....infact most people do a combination of three different activities, but there is a choice of 11 different activities.

    I could have 11 fields with the different types of activities, but most people go to at least 10 or 12 different locations.

    Any suggestions?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Conventional structure would be a related table with a record for each activity for each location for each person.

    Consider:

    tblPeople
    PersonID

    tblPeopleLocations
    ID (primary key)
    PersonID (foreign key)

    tblLocationActivities
    PeopleLocationID (foreign key)
    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
    Winter1 is offline Novice
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    5
    Thank you got it, I have many tables, and the location and activities are set in two fields! I have managed to get my one-many relationships and enforce referential integrity. I have now run a test of queries and they seem to give me intelligible answers!

    Winter

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

Similar Threads

  1. Replies: 5
    Last Post: 06-25-2014, 09:19 AM
  2. Replies: 4
    Last Post: 10-22-2013, 11:38 AM
  3. Replies: 1
    Last Post: 05-20-2013, 01:45 PM
  4. Replies: 3
    Last Post: 03-23-2013, 03:13 PM
  5. Replies: 7
    Last Post: 10-16-2012, 06:43 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