Hello all!
I've got a class tied to a report that I'm building, and 3 of the properties are City, State, and Zip. Zip is not currently sent over with a dash, just the 5-9 numbers.
I want to format zips on my report longer than 5 characters as "99999-9999", and Zips that are 5 characters "99999". Fairly basic stuff. I am also combining the City, State, and Zip of my report into 1 text box.
I'm trying to get cute (which is always dangerous), but I'm hoping someone can explain why this code throws a 'Specified argument was out of the range of valid values. Parameter name: startIndex' when I go to preview the report. If I don't have more than 5 characters, I don't want it doing the insert. Since the 'test data' is empty (as I'm just previewing the design), it shouldn't be evaluating the Insert I wouldn't think.
=Format("{0}, {1} {2}",Trim(Fields.City), Fields.State, IIf(Len(Fields.Zip)>5, Insert(Fields.Zip,5,"-"),Fields.Zip))
Thanks for any info!