Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

convert intiger to string and show string after report

hi,i have a problem i store data as integer format in the database and i want to report it with using visual basic DATA REPORT.for instance male is stored as 0 and female stored as 1 and i want to report them but it is shown as 0 or 1. how can i show them as string male or female...
My body fails
My soul will rise

Comments

  • jlegjleg Member Posts: 237
    : hi,i have a problem i store data as integer format in the database and i want to report it with using visual basic DATA REPORT.for instance male is stored as 0 and female stored as 1 and i want to report them but it is shown as 0 or 1. how can i show them as string male or female...
    : My body fails
    : My soul will rise
    :
    I had a look at this and found a way to do it. There is probably a couple of ways but here it is anyway. I've made a couple of assumptions.

    1. your using jet access databases
    2. There is either 0 or 1 integer in a field called sex

    You need to modify The dataevironment command SQL you are using.

    SELECT Name, Sex, IIF(Sex = 0,'Male','Female') As SexString FROM MyTable

    This sould return 3 columns of data, Name, Sex, SexString

    SexString is conditional on what is in Sex. One thing I noticed was the DataEnvironment gave me an error when I was creating the SQL statement, but when you run it anyway it works.

    Use this command as the source of the data report.

    See how you go.

    John ;-)
  • milorat777milorat777 Member Posts: 9
    thnxs a lot

    it is funny that before i look at here i found "IIF" code in an e-book and decided to solve my problem with it :o).
    My body fails
    My soul will rise

Sign In or Register to comment.