PDA

View Full Version : How do I replace "#Type!" with "?" in relevant field?


sjk633
Jun 18, 2015, 10:39 PM
Using Access 2010, in limited field space on a report, I have reduced relevant name of volunteer offering assistance to first-name & first-letter-of-last-name with the following:-

=[txtHelpFName] & " " & Left([txtHelpLName],1)

All works well when the volunteer details have been provided or known. When they are not available, the field populates with "#Type!", which I would like to modify with a simple "?"

Any suggestions on how this can be achieved? Would an IIF Function work, using the above for the TRUE component of the statement?

Thank you...

ScottGem
Jun 19, 2015, 05:24 AM
You are close with the IIF, but the problem appears to be when one or more of the fields is Null. Null is a special value that doesn't mean blank, but rather Nothing. You can trap for Null by changing your expression to:

=Nz([txtHelpFName],"") & " " & Left(Nz([txtHelpLName]," "),1)

I include a space in the second Nz so the Left() function doesn't choke on a zero length string.

If that doesn't work, then you may need to use an IIF to test for Null values.