I have a report with a text box that I wish to conditionally populate with either the difference between two numeric fields or fill with "N/A". The field "dataType" contains the data type, and if "int"or "decimal" the ChangedFrom and ChangedTo fields contain valid numeric values. At runtime the "int" and "decimal" calculations indeed work and the text box is populated correctly. But all other values, like "date" and "varchar" result in #Error being returned. This should be easy . . . Any suggestions?
Thanks
=Switch(Fields!dataType.Value = "int", Fields!ChangedTo.Value - Fields!ChangedFrom.Value,
Fields!dataType.Value = "decimal", Fields!ChangedTo.Value - Fields!ChangedFrom.Value,
Fields!dataType.Value = "date", "N/A",
Fields!dataType.Value = "varchar", "N/A" )