Results 1 to 12 of 12
  1. #1
    Leonidsg is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    68

    Storing Data from LookUp Combo Box in Table as text a poor idea

    Quick design question. In my forms I have several combo boxes with lookup tables. When something is selected from the form it saves as the ID in the table which is a text field currently. Is is a bad idea to have it save as a the actual text instead of the ID. Also if I keep it as the ID and in the future make a change to the lookup table where a particular ID does not correlate the same text, will this change be reflected in the tables.



    Thank you
    Lenny

  2. #2
    Beetle is offline Unrelatable
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    Camp Swampy (Denver, CO)
    Posts
    207
    When something is selected from the form it saves as the ID in the table which is a text field currently. Is is a bad idea to have it save as a the actual text instead of the ID.
    This statement is a bit conflicting. Are you storing the numeric ID value (correct), or the text that is associated with the numeric ID value (incorrect)?

    Also if I keep it as the ID and in the future make a change to the lookup table where a particular ID does not correlate the same text, will this change be reflected in the tables.
    Yes, except that the last part of that statement should say the change will be reflected in the combo boxes, forms, reports or other objects that reference the value from the lookup table.

  3. #3
    Leonidsg is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    68
    Quote Originally Posted by Beetle View Post
    This statement is a bit conflicting. Are you storing the numeric ID value (correct), or the text that is associated with the numeric ID value (incorrect)?

    Currently it is storing the Number ID instead of the text, this seems like the more correct method?

    Yes, except that the last part of that statement should say the change will be reflected in the combo boxes, forms, reports or other objects that reference the value from the lookup table.
    Makes sense. Thank you

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Primary and foreign key fields must be the same datatype.

    Whether you save the ID or text value depends on situation. If the table is simply:
    ID Condition
    1 Poor
    2 Fair
    3 Good
    4 Excellent

    I suggest just saving the text Condition and eliminating the complication of having to join tables to retrieve the related value.
    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
    Leonidsg is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    68
    That is mostly the case but some of the text can have up to 4 words. Like "Spica Cast wo stabilization". Does it become too much at that point. One big one I have is the Bones lookup table which is mainly two words: "L Femur" , "R Femur" etc.

    Thank you

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Yes that does get long and if this was 30 years ago when memory came at a premium, would definitely use the ID value. Indexing on text can slow sorting but you will often want to sort on the text values instead of the numeric ID. Lookup alias in combobox can be aggravating in some situations as well as having to always include the lookup table in queries to retrieve the text alias. So decide which way works best for you.
    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
    Leonidsg is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    68
    Hey June7. Thanks again for your help. Would you mind telling me how to change the text to be stored instead of the Id. Thank you.

  8. #8
    Leonidsg is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    68
    I think I figured it out, I changed the bound column. Does that sound correct? Thank you

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    If you want to save the text, don't even need the ID field in the RowSource.
    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.

  10. #10
    Leonidsg is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    68
    Quote Originally Posted by June7 View Post
    If you want to save the text, don't even need the ID field in the RowSource.
    Hey Juen7, so I finally got around to working on this part. My row source reads "SELECT [DEXALocationLkUp].[DEXALocation] FROM DEXALocationLkUp; " Everything looks good, when I click on my combo box in the form I can see my text choices but when I click on the choice it doesn't show it on the form or save it to the table.

    Any suggestions.

    Thank you
    Lenny

    Edit: figured it out, needed to change bound column to 1. Thank you

  11. #11
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Is the BoundColumn property set as 1? Is the ColumnCount set as 1? Is the ControlSource set to the correct field?
    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.

  12. #12
    Leonidsg is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    68
    Everything was correct except bound column. Once I changed that it worked great. Thanks again.

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

Similar Threads

  1. Replies: 4
    Last Post: 12-05-2012, 05:10 PM
  2. Poor Word Wrapping When Exporting Report to Rich Text File
    By caki2112 in forum Import/Export Data
    Replies: 11
    Last Post: 11-01-2012, 03:00 PM
  3. Replies: 1
    Last Post: 08-03-2012, 12:32 PM
  4. Combo Box Displaying Text, But Storing ID
    By SeaTigr in forum Forms
    Replies: 4
    Last Post: 11-22-2011, 08:58 AM
  5. Combo Box not growing with lookup table
    By Joe_A in forum Access
    Replies: 5
    Last Post: 10-12-2011, 06:26 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