Results 1 to 6 of 6
  1. #1
    Bazsl is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2016
    Posts
    47

    Is it possible to have a lookup field that stores a value other than the primary key?

    Is it possible to define a lookup field that stores a value other than the primary key of the lookup table? The lookup wizard allows me to pick the field I want to store in the database but no matter which field I pick the value stored in the table is always the primary key of the lookup table.



    The lookup table in this case has two columns; Location and Description. Location is the primary key. Description has a unique index and is the field I want to store in the table. Thanks.

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You could try changing the Bound column to a different number.
    Or, in the look up field, move "Description" to be the first column (the bound column).

    "Description" is a reserved word and shouldn't be used as object names.


    Using a Look up FIELD (in a table) is the wrong think to do. (IMO)
    I never, ever use look up FIELDs (in a table). (Look up tables are a different animal)

    See
    http://access.mvps.org/access/tencommandments.htm
    and
    http://access.mvps.org/access/lookupfields.htm

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    you can do 2 Dlookups
    1 to get the key,
    then 2 to get the other item using the key

    or

    put them in a combo box,with both columns
    select 1 item and pull the other column value....
    Code:
    sub cboBox_afterupdate
      txtBox = cboBox.column(2)
    end sub

  4. #4
    Bazsl is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2016
    Posts
    47
    Steve,

    Thanks for your reply. I am accustomed to databases where data integrity enforcement and manipulation is done on the back end using stored procedures and triggers so Access is a major conceptual shift. The reason I want to use lookup fields in a table is so we can start data entry. We have about 10,000 items that must be manually entered into one table. Getting the forms designed and learning enough VBA to make them work is going to take awhile.

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    We have about 10,000 items that must be manually entered into one table
    Ugh.....what a nightmare!

    Have you thought of creating a CSV file and importing the data?

  6. #6
    Bazsl is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2016
    Posts
    47
    Not really. Whatever the disadvantages of working directly with tables may be I can have some control of the integrity of the data being entered with referential integrity and lookup fields. At least it is better than having unskilled volunteers keying the data into a spreadsheet with no validation at all. This is a small app for a very small not-for-profit that my daughter works with. I am just an old retired programmer who "volunteered" to help out from a thousand miles away.

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

Similar Threads

  1. Replies: 4
    Last Post: 03-17-2016, 07:16 AM
  2. Lookup values not appearing in Lookup field?
    By dominover in forum Access
    Replies: 4
    Last Post: 03-05-2016, 05:01 PM
  3. Replies: 2
    Last Post: 11-03-2015, 02:30 AM
  4. Converting lookup text field to number for primary
    By Ruegen in forum Database Design
    Replies: 4
    Last Post: 09-11-2013, 08:23 PM
  5. Replies: 5
    Last Post: 09-09-2013, 03:00 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