Results 1 to 10 of 10
  1. #1
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265

    Which is better?

    Suppose I have a table called "Contacts" with a field called Gender. In order to populate the Gender field in Contacts, which is the better solution and why:






    A. Create another table called "Gender." The Gender table has autoNumbers and then the gender, e.g. 1 = Male, 2 = Female, 3 = Not specified. In the Gender field of Contacts, enter the correct gender ID number for each person. Then after that, in Design View in the Gender field data type, use the Lookup Wizard to create a drop down menu, where the values in the drop down are imported from the Gender table.

    B. Do not create a separate Gender table. In the Gender field in Design View, use the Lookup Wizard to create a drop down menu, where I type in the possible gender values.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    I NEVER set lookups in tables if there is alias involved for the reasons enumerated in the link provided by RG, and rarely bother to setup combo/list box in table even if alias is not involved.

    Whether or not to use a table as source for the 3 gender options is a matter of choice, and saving an ID or the descriptor is another choice. I vote for M, F, N and no table.
    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.

  4. #4
    KathyL is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    94
    For something as small as having only 3 options, having a separate table is rather silly. Use a dropdown. I’d put the dropdown on a form, such as a List Box, where you’d just type in the 3 values you’d want to choose from. As a 30 year application designer, I rarely put edits and requirements into the table, I keep tables basic, and put all my criteria and editing in a form, often using Visual Basic events behind the form.

  5. #5
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    C. Create another table called "Gender." The Gender table has three records for the gender, "Male", "Female", "Not specified". In Design View in the Gender field, use a listbox with your Gender Table as its record source, restricted to the list.

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by Dal Jeanis View Post
    C. Create another table called "Gender." The Gender table has three records for the gender, "Male", "Female", "Not specified". In Design View in the Gender field, use a listbox with your Gender Table as its record source, restricted to the list.
    I agree.

    edit: except I prefer not to use lookup fields.

    Having it in a table will help to remind you what Key = what gender. If a developer comes in behind you to expand your app, they won't have to search for a Key value. I use a naming convention for my tables such as tblCustomers, where tbl represents a tbl. If the table is something that lists out states or gender, etc. I use lst to help distinguish what the table is storing. lstGender, lstStates

    Just a suggestion.

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    My preference would be to not have a key for such a small number of brief descriptors. Just save the actual text value - no alias, no table joining, no translation between key and descriptor.
    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.

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    It is a good thing the OP asked. At least now they have a concrete answer!

  9. #9
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by RuralGuy View Post
    Thank you everybody. This makes sense. So I would not use a Lookup to mask the underlying ID number. Instead, I think I will just have a Lookup where I type in the values that can appear. That way nothing is masked. I think another poster mentioned this possibility.

  10. #10
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by KathyL View Post
    For something as small as having only 3 options, having a separate table is rather silly. Use a dropdown. I’d put the dropdown on a form, such as a List Box, where you’d just type in the 3 values you’d want to choose from. As a 30 year application designer, I rarely put edits and requirements into the table, I keep tables basic, and put all my criteria and editing in a form, often using Visual Basic events behind the form.
    I think I will go with this. Thank you KathyL.

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

Tags for this Thread

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