I want a field to display "None" when it has no value

6 posts, 0 answers
  1. Sadie
    Sadie avatar
    4 posts
    Member since:
    Sep 2014

    Posted 30 Sep 2014 Link to this post

    Is there a way to cause a data field to display the string "None" when the field has no value?  Otherwise the field should display its appropriate value.  

    I was trying to use a combination of the IIF() and ISNULL() functions like this for the field's Value property

    = IIf(IsNull(Fields.AccountCode),"None", Fields.AccountCode)

    but I was getting errors that said:

    An error has occurred while processing TextBox 'textBox17':
    Type mismatch in function arguments. Cannot find an overload of the function IsNull() that accepts arguments of type (String).


    Thank you.  Any help would be most appreciated.  I am still very new to coding.
  2. Ben
    Ben avatar
    6 posts
    Member since:
    Sep 2014

    Posted 30 Sep 2014 in reply to Sadie Link to this post

    have you considered moving the condition to your query data source or is that an option? ie :

    'select ISNULL(column, 'NONE') as columnA from table'
  3. DevCraft banner
  4. Sadie
    Sadie avatar
    4 posts
    Member since:
    Sep 2014

    Posted 30 Sep 2014 in reply to Ben Link to this post

    I don't think that is an option as I need to be able to view all of the data; even where some fields are empty.  For aesthetic reasons I'd like to fill in the empty fields with placeholder text, but if I can't do that it is ok.

    Thank you for the reply though.
  5. Sadie
    Sadie avatar
    4 posts
    Member since:
    Sep 2014

    Posted 30 Sep 2014 in reply to Ben Link to this post

    Wait, I'm sorry. I'm very new to SQL. I was thinking that you meant to remove the Nulls from the dataset. Could you please explain to me what the SQL you used is meant to do? Does it replace Null values with the string 'None'?  Thanks so much.
  6. Ben
    Ben avatar
    6 posts
    Member since:
    Sep 2014

    Posted 30 Sep 2014 in reply to Sadie Link to this post

    yes it replaces the values.
  7. Sadie
    Sadie avatar
    4 posts
    Member since:
    Sep 2014

    Posted 30 Sep 2014 in reply to Ben Link to this post

    I will try that. Thank you.
Back to Top
DevCraft banner