Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Posts
    3

    Unanswered: Value of Gender option button in reports

    I have gender group (with Male and Female option buttons) in the forms and it is storing as 0 or -1 in the sqlserver backend. It is nvarchar type. In reports, I need to show it as Male or Female depending upon 0 or -1 in the table. How do I do that? It is showing 0 or -1 in the reports.

    Thanks

    vinbin

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    try:

    dim theGender as string
    if theNameOfYourNvarChar then 'equivalent to if xxx = TRUE
    theGender = "Male"
    else
    theGender = "Female"
    endif

    access uses 0=FALSE, not(FALSE) = -1 = TRUE
    my mySQL setup seems to use 0/1 ...far as i can tell, odbc takes the strain.

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Jan 2004
    Posts
    3
    Well, I tried iif(Gender = "0", "Male", "Female") in the query of the report and it worked.

    Thanks

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    yes, it works, but i got into trouble on this site a few days ago for "cheating" like that. you are supposed to forget that true=-1/false=0 and use the intrinsic constants TRUE/FALSE.

    so, more politically correct would be:
    iif(Gender, "Female", "Male")


    izy
    currently using SS 2008R2

  5. #5
    Join Date
    Jan 2004
    Posts
    3
    Thanks!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •