Results 1 to 10 of 10
  1. #1
    bubai is offline Competent Performer
    Windows 7 32bit Access 2016
    Join Date
    Nov 2014
    Location
    Dhaka
    Posts
    162

    About Lookup table, lookup fields and composite (multi-field) primary keys.


    Hello there.
    Lookup table and lookup fields are two common tools in designing database. But I cannot seem to distinguish them properly. My understanding is - Lookup table is where the primary key is and Lookup field is where we put the foreign key. But there is a widespread consensus among database experts and bloggers that lookup fields must be avoided. But how can one not be there when another one is there? Moreover, what good is a primary key if it cannot be used as a reference? Can anybody explain in detail?
    Apart from this, some say composite (multi field) primary key should not be used in order to AVOID DUPLICATE RECORDS AMONG MULTIPLE FIELDS. Instead, a secondary index for those fields should be created and defined them as unique. But I have multiple fields which I need to be duplicate within the single field but they cannot come duplicate when multiple fields combined. Can you tell me how to do this without using composite primary key?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Don't build lookup fields in table, build combobox and listbox on form.

    Set compound index on field combinations that cannot be duplicated. Does not have to also be designated as primary key. This will prevent duplicate combinations.
    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
    bubai is offline Competent Performer
    Windows 7 32bit Access 2016
    Join Date
    Nov 2014
    Location
    Dhaka
    Posts
    162
    Quote Originally Posted by June7 View Post
    Set compound index on field combinations that cannot be duplicated. Does not have to also be designated as primary key. This will prevent duplicate combinations.
    When I select multiple fields the indexed options do not show up. But if I make them indexed separately then it wont serve the purpose. Also, can you describe what Lookup table and what Lookup fields are?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Review
    http://www.geeksengine.com/article/c...ex-access.html

    There is no issue with using lookup tables, just don't build lookup fields in another table that pulls values from lookup table, especially lookups that use alias. This means an ID is saved but descriptive value is displayed. An example of a lookup table would be a Products table. User will see product name/description but ProductID will be saved into OrderDetails table.

    Build comboboxes and listboxes on forms.


    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
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529

  6. #6
    bubai is offline Competent Performer
    Windows 7 32bit Access 2016
    Join Date
    Nov 2014
    Location
    Dhaka
    Posts
    162
    Quote Originally Posted by June7 View Post
    An example of a lookup table would be a Products table. User will see product name/description but ProductID will be saved into OrderDetails table.

    Build comboboxes and listboxes on forms.
    Thanks for the indexing link.
    But if I name the lookup fields in a way so that it reminds me that it is an ID field, not an alias will it then be OK? Because, either way the ID is saved to the field.

  7. #7
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    You may find the info in this thread helpful --see the materials related to Reference and Lookup Table.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    Entirely your decision. But if someone else ever has to manage this db, you may be just building in confusion for them.
    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.

  9. #9
    Mickjav is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Location
    Margate, Kent
    Posts
    123
    I've added a picture but you should allways give fields names that relate to the information thay will be storeing like JoinDate which indecates the value to be stored is a date.
    also giiving the objects I.E. tables or forms a meaningful name will help when designing projects.

    hope it helps mick
    Click image for larger version. 

Name:	2019-10-10 (3).png 
Views:	22 
Size:	15.2 KB 
ID:	39921

  10. #10
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    For good measure I'll throw in this about Primary Keys Microsoft Access Tables: Primary Key Tips and Techniques

    Also see Microsoft Access and SQL Server Database Normalization Tips
    Look for paragraph "Use a Meaningless Field for the Key Field"

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

Similar Threads

  1. multi primary keys relations in 1 table
    By Carloj in forum Queries
    Replies: 2
    Last Post: 08-08-2018, 05:42 AM
  2. Replies: 20
    Last Post: 01-09-2017, 12:08 AM
  3. Replies: 4
    Last Post: 03-17-2016, 07:16 AM
  4. Replies: 1
    Last Post: 01-27-2016, 04:30 PM
  5. Replies: 1
    Last Post: 05-24-2012, 09:35 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