SQL data type ENUM caused error

  • Thread starter Thread starter Bryboy
  • Start date Start date
B

Bryboy

I am linked to a SQL database and have a field which is a ENUM with the
options of 'm' or 'f'.

In a report I am trying to work with this in a formula, but receive an
error. It doesn't seem to be a string or number.

Do I need to convert it to some other type? Here is my formula with the
field name "gender".

=IIf([gender]="m", "Boys","Girls")

Returns Error
 
SQL - ENUM caused error

Hi- there is a third option in your scenario and that is the value could be null.
Your IIf statement should account for this by having IIf([gender]="m", "Boy", IIf([gender]="f","Girl",""))

This will translate a blank for the null valued items; you could also set the null values to "None"
instead of ""

I hope this helps.
 
Back
Top