Results 1 to 4 of 4
  1. #1
    Khalil Handal is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jun 2016
    Posts
    310

    Replace the number with value on a report for Gender

    Hi to all
    In a table design I have Gender field with Data Type: Number where 1 is for Male and 2 is for Female.
    On the form I have an Option Group for Gender, the user selects either button.
    I created a report and on the report the value for gender field is shown as either"1" or "2".

    Is it possible on the report to replace the 1 for Male and the 2 for Female?



    Thank you
    Khalil

  2. #2
    Join Date
    Apr 2017
    Posts
    1,792
    Options

    1. Edit the source query of report like
    Code:
    SELECT ..., Iif(Gender=1,"Male","Female") ...
    2. Have a table like Genders: Gender, GenderTxt
    with values
    Gender GenderTxt
    1 Male
    2 Female
    Edit the source query of report like
    Code:
    SELECT yt.Field1, ..., g.GenderTxt, yt.Fieldn FROM YourTable yt INNER JOIN Genders g ON g.Gender = yt.Gender
    And I'd advice to use combo box for selecting the gender in your form, WITH ControlSource property as Gender (The Gender field in your original table). In case you don't have a table for genders, set the RowSourceType property for combo as "Value List", and RowSource property as "1, Male, 2, Female". In case you have a table for genders, set the RowSourceType property for combo as "Table/Query", and RowSource property as "SELECT Gender, GenderTxt FROM Genders ORDER BY ...". Set ColumnCount property for combo to 2, BoundColumn property to 1, and ColumnWidths property like "0,2.5"
    Now whenever user clicks on the combo, user can select between "Male" and "Female", and depending on made selection, the value of combo will be either 1 or 2.

  3. #3
    jojowhite's Avatar
    jojowhite is online now Competent Performer
    Windows 11 Access 2021
    Join Date
    Jan 2025
    Posts
    432
    as advised, use query as recordsource of your report.

    you can also use Choose() function on your Query:

    Code:
    Select field1name, field2name, Choose([gender], "Male", "Female") As Sex From yourTableName;

  4. #4
    Khalil Handal is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jun 2016
    Posts
    310
    Hi,
    Got it working
    Thank you both

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

Similar Threads

  1. Count by age range AND gender
    By ncub in forum Reports
    Replies: 10
    Last Post: 10-24-2020, 06:24 AM
  2. Group age and gender in the report
    By a.phoenix in forum Reports
    Replies: 2
    Last Post: 10-17-2017, 09:20 PM
  3. Option Group for gender
    By hamidchi in forum Forms
    Replies: 3
    Last Post: 08-23-2015, 12:07 PM
  4. How to group people's titles by gender?
    By Idznak in forum Queries
    Replies: 3
    Last Post: 11-17-2013, 09:56 AM
  5. Sorting a questionnaire by gender
    By uchiha37 in forum Access
    Replies: 1
    Last Post: 10-07-2010, 07:37 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