Link to home
Start Free TrialLog in
Avatar of monica73174
monica73174

asked on

MS SQL Reporting format error

Here is the format:

=format(cdec(Fields!SSN.Value), "###-##-####")

Error if the value is " ".  How to check before convert this field value to decimal?
Avatar of reb73
reb73
Flag of Ireland image

You should be able to use the ISNUMERIC function to check if the value is a number -

= IIF(IsNumeric(Fields!SSN.Value), format(cdec(Fields!SSN.Value), "###-##-####"), Fields!SSN.Value)
Avatar of monica73174
monica73174

ASKER

still has error:
Here is the code:

=IIF(IsNumeric(Fields!SPOUSE_SSN.Value),format(cdec(Fields!SPOUSE_SSN.Value), "###-##-####"), Fields!SPOUSE_SSN.Value)

Error show in the field:  #Error

Warning message:
[rsRuntimeErrorInExpression] The Value expression for the textbox SPOUSE_SSN contains an error: Conversion from string "" to type 'Decimal' is not valid.
Preview complete -- 0 errors, 1 warnings



ASKER CERTIFIED SOLUTION
Avatar of reb73
reb73
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It works.  Thank you very much for your help!!!