Results 1 to 5 of 5
  1. #1
    funkygoorilla is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    93

    Query returns Primary Keys

    Hi, when I create queries the results that get returned are not the field names of the selections but the record number associated to the field.
    For example; I have a table with three entries a user can pick from in a drop down box. Column one is the numbers, column 2 is the descriptions.
    1 Blue
    2 Green
    3 Red
    I would like the query to return red, but it returns 3.
    Is there a setting for this?

    Thanks,
    FunkyG

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by funkygoorilla View Post
    Hi, when I create queries the results that get returned are not the field names of the selections but the record number associated to the field.
    For example; I have a table with three entries a user can pick from in a drop down box. Column one is the numbers, column 2 is the descriptions.
    1 Blue
    2 Green
    3 Red
    I would like the query to return red, but it returns 3.
    Is there a setting for this?

    Thanks,
    FunkyG
    First off, the ID SHOULD be what is being stored in the table. The reason why the description isn't showing when you create the query is that you are using LOOKUPS defined at TABLE level which you really shouldn't be doing. See here for more about why you should NOT be using those:
    http://www.mvps.org/access/lookupfields.htm

    Also, when creating your query you need to include the lookup table and link the appropriate ID field between the two and then select the description field from that lookup table for your query instead of the ID field which is in the table you have the data stored in. It will then display the descriptions instead of the ID's.

  3. #3
    funkygoorilla is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    93
    Hi Bob,
    Thanks for your reply. However, I do not use lookups on my tables. I am using combo boxes with the source of them being tables. When I choose these fields to display in a query, thats when the value comes back as the primary key. When you talk about linking them,do you mean linking them in the query designer?
    FunkyG

  4. #4
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    If you are actually using the combo reference in your query, it would return the value of the bound column of the combo. So, if your combo's row source has the ID and then the description and the property BOUND COLUMN of the combo is set to 1 it will return the ID. If the bound column property is set to 2 it would return the description (as long as the combo's COLUMN COUNT property is also set to the number of columns in the row source query).

  5. #5
    funkygoorilla is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    93
    Hi Bob, that looks like the trick. Thank you very much. It was also a "mis-relationship" issue, but your tip in a way led me to that.
    Thanks again!

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

Similar Threads

  1. Query using the same primary keys.
    By Franuzz in forum Queries
    Replies: 1
    Last Post: 04-11-2011, 11:27 AM
  2. Replies: 2
    Last Post: 09-22-2010, 02:25 PM
  3. Multiple primary keys
    By elektrisk in forum Access
    Replies: 5
    Last Post: 02-11-2010, 04:39 PM
  4. Primary and Secondary Keys...
    By LittleOleMeDesigns in forum Database Design
    Replies: 5
    Last Post: 07-24-2009, 11:33 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