Results 1 to 8 of 8
  1. #1
    yellowgelb is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2015
    Posts
    14

    Can I use a field with the property "allows multiple value"as a Primarykey to enforce a relationship


    I am working on a database for wildlife data. I have a main table called tblbasicdata, which contains a lot of parameters (as date, age, location...) to each sample. Many of these parameters are actually extra tables connected to tblbasicdata as a combo box with a table source. They are all connected by one-to-many relationships. Now, I would like to enforce a relationship of the field BasHowSexed with the related table tblHowSexed. The field BasHowSexed has the property Allow Multiple Values set as yes, since the scientists use different options to sex one single animal.
    But Access is not setting up a relationship and tells me that the tblbasicdata is violating the rules. I checked everything and can't find a bug. Is it possible that I can't use fields with the property "allow multiple values" as a primary key? If this is the case how could I fix the problem?

    Thanks a lot for your help!!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    That is correct. Multi-value fields cannot be primary key. Why would you want to? I don't understand why you have this issue.

    By the way, I NEVER use multi-value fields.
    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
    yellowgelb is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2015
    Posts
    14
    Hi,
    Thanks for the quick reply.
    I will try to explain it. In the field BasHowSexed I need to have the option to select more than one type of sexing, because that's what they do when they work outside in the field. I have 12 option how they can sex the birds and more or less all combination are possible. In the database exist two forms. One for the data entry and one to filter the data. In my main database tblbasicdata I've got more than 10000 samples and about 20 rows with the different results and parameters (as age, howaged, species, location, sex and so on). One of them is the parameter HowSexed. If I would use a general primary key I don't have the possibility to choose more than one item (sexing parameter) for each sample, do I? The only other option which comes to my mind, if not using a multiple-value field, is to set up all possible combinations in the table tblHowSexed.

    Do you understand now why wanted to use the multiple-value-field? Do you have any other recommendation how to deal with that?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I understand multi-value field to save multiple sexing methods utilized for each sample. I don't understand why you want it to be a primary key. The multi-value field would be a foreign key field, not primary key. Is this field in tblbasicdata?

    You said 20 rows, did you mean fields?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    yellowgelb is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2015
    Posts
    14
    You are right the multi-value field would be a foreign key field and yes 20 rows are actually the columns. And sure the field BasHowSexed is a field in the tblbasicdata, since I was trying to enforce a relationship between this the table tblbasicdata and tblHowSexed. But now I wondering if I actually need to enforce this relationship, because it is only a descriptive selection and I have set the properties in the tblbasicdata for this field "limited to list" to yes. I don't allow any editing.

    I attached the database. Happy about any recommendations! Please be aware that the names in the database are slightly different, but I think it's self-explanatory. Thanks!
    Attached Files Attached Files

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I was able to establish relationship between tblHowSexed and tblBasicData.
    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.

  7. #7
    yellowgelb is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2015
    Posts
    14
    Hi,
    the whole process was helpful in terms that I figured out the fault I made. Now I can set up a relationship between this both tables.
    But actually I would rather avoid using a look up field for the field HowSexed. But I still need to have the possibility to combine the 11 different ways how people can sex the birds in one field. How can I do that? Because actually you shouldn't have two information in one field? I am a bit confused regarding this issue and could need a good advice.

    Thanks a lot for your help!!

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Save the data in normalized structure then manipulate as needed for output. Review this article for method to display related data from multiple records as a single value http://allenbrowne.com/func-concat.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.

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

Similar Threads

  1. Replies: 12
    Last Post: 08-07-2014, 10:28 AM
  2. Replies: 3
    Last Post: 04-22-2013, 06:08 AM
  3. Replies: 8
    Last Post: 10-24-2012, 12:47 PM
  4. Index = "PrimaryKey" error with SQL BE linked
    By Brian62 in forum SQL Server
    Replies: 49
    Last Post: 06-28-2012, 04:47 PM
  5. Replies: 16
    Last Post: 07-22-2011, 09:23 AM

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