Results 1 to 6 of 6
  1. #1
    AccessDenial is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Aug 2018
    Posts
    8

    Managing multivalue fields

    Understand Access has multivalue fields but its causing me some issues when implementing other features such as audit trails. Besides it is not a norm in database administration? Hence, I'm trying to do it the "right way" by creating separate tables. The following is an example of say recording the type of fruits my employees like.

    Fruits Table:
    NUM...FruitPreference
    1...Apple
    2...Pear


    3...Orange
    4...Apple Pear
    5...Apple Orange
    6...Pear Orange

    Employee Table:
    Name...NUM
    John...2
    Paul...4
    Mary...6

    I created my form and naturally I do not want the user selection to be based on NUM nor the entire list of fruit preference (imagine if there are more combinations and everything must be listed). Ideally, it should just be Apple, Pear, Orange and the respective number returned to the NUM column in my Employee Table depending on which combination they choose.

    Is this possible?

    Thanks in advance.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Dump the multivalue field method, (I never use it)
    Its much easier to just use a subTable. 1-many

    NUM...FruitPreference
    3...Orange
    4...Apple
    4...Pear
    5...Apple
    5...Orange
    6...Pear
    6...Orange

  3. #3
    AccessDenial is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Aug 2018
    Posts
    8
    Hi! Could you elaborate more on how to do a subTable please? I don't understand your example. Sorry!

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    its just a table with the Key (NUM) from the master table.
    if you want the subTable to have NO duplicates , then you must key both fields in tFruitOwned:
    num*
    FruitPreference*

    then in Relationships, join keys: Employee.Num to tFruitOwned.Num

    (now you can have many fruit to the 1 employee , without duplicates)

  5. #5
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    In its simplest form, you need 3 table:
    a table for Employees
    a table for Fruits
    and a junction table to hold the selections.
    Click image for larger version. 

Name:	Fruits1.png 
Views:	12 
Size:	29.4 KB 
ID:	35006


    You would use a main form/sub form to make the selections.
    You could have a main form for the employees and the sub form to select the fruits
    OR
    you could have the main form select a fruit and the sub form to select the employees that liked that fruit.

    If you did not want John and Banana to be selected more that once, you would set a compound INDEX (not a compound PK fields) on the fields EmployeeID_FK and FruitID_FK. See Microsoft Access Tables: Primary Key Tips and Techniques

  6. #6
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,742
    Here's a working skeleton model. People main form and Fruit subform. Many-to-many table setup.

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

Similar Threads

  1. Converting Multivalue Fields to Records
    By rjgriffin46 in forum Access
    Replies: 12
    Last Post: 05-02-2016, 12:01 PM
  2. Replies: 3
    Last Post: 11-14-2015, 07:17 AM
  3. Convert multivalue fields back to normalized tables
    By TXStateMom in forum Programming
    Replies: 5
    Last Post: 08-26-2014, 03:21 PM
  4. Move to SharePoint and multivalue fields?
    By Mercator in forum SharePoint
    Replies: 2
    Last Post: 12-27-2012, 07:06 PM
  5. How to display multivalue fields
    By Trojnfn in forum Access
    Replies: 5
    Last Post: 10-22-2012, 03:48 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