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

    Choice of Male or Female. What data type to use?


    I have a field called Gender. Eventually I will connect a form to this table and have a combo box where the user can select either "Male" or "Female." Based on this, what data type should I assign to the Gender field when I'm designing the table in Design View? Would I use the Yes/No data type?

  2. #2
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Drop down combo box, text field (but a number field on the main form as that stores the ID)- relate main table it to a gender table with a one to many

    or if you want it in the same table then yes - as there are only two options () you can make it a yes no a button that but that will only allow you to see if ticked male OR female depending on what the checkbox is going to be if checked. I.e. if checked then it is male, if unchecked then female. So you will have a default which is messy since if the user doesn't check the box the default will be given even if the person is the opposite sex...

    I'd go to the effort of the first option even if it means making a new table.

    Main table
    ID Name Gender
    1 Bob McGee 1
    2 Sally Smith 2

    Gender table
    ID Gender
    1 Male
    2 Female


    You can also use group options instead of combo or check

    Click image for larger version. 

Name:	Capture.JPG 
Views:	31 
Size:	33.5 KB 
ID:	13777

  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
    53,615
    I vote for text with M/F and no lookup 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
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265

    RE: Choice of Male or Female. What data type to use?

    Quote Originally Posted by June7 View Post
    I vote for text with M/F and no lookup table.
    June7. How would you implement your solution of no lookup table? I am just beginning Access.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,615
    You can use the Value List option of creating a combobox or listbox RowSource.

    Properties:

    RowSourceType: Value List
    RowSource: F;M

    Access Help has guidelines.
    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.

  6. #6
    Renaud's Avatar
    Renaud is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2013
    Location
    Hong Kong
    Posts
    4
    I'll add my voice to June7 and would also recommend dispensing with the lookup table and just use a Text field with F, M (or Male, Female, in full at the expense of some database space).
    This will make queries less complicated than a lookup table, sometimes we must be careful not to go overboard with unnecessary data normalisation, especially when there is no major upside to it.

    Even if you stick with a single letter M/F, and you end up having to consider gender in a less binary way (like in Australia where people can now also opt to have a neutral gender on their official papers), adding more values, like X, will not be an issue.

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

Similar Threads

  1. Replies: 3
    Last Post: 05-31-2013, 04:32 PM
  2. Group by and count if "Male"
    By Bertrand82 in forum Programming
    Replies: 6
    Last Post: 11-08-2012, 07:39 AM
  3. Data Type Mismatch in SQL
    By Phred in forum Queries
    Replies: 2
    Last Post: 01-04-2012, 03:40 PM
  4. Replies: 2
    Last Post: 03-18-2010, 08:24 PM
  5. data type mis match
    By cowboy in forum Programming
    Replies: 3
    Last Post: 03-12-2010, 11:54 AM

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