Skip to content

Keeping Leading Zeroes in SSNs

How to ensure leading zeroes are not discarded.

Q:  Albin Moroz wrote me to say that he is having problems keeping the leading zeroes in U.S. Social Security Numbers (SSNs).  He was using the expression

Format(Nz(patientRS(patient.SSN), “”), “###-##-####”)

which discards leading zeroes.

A:  Instead of the # placeholder, which discards zeroes, use the @ placeholder, which treats zeroes as characters:

Format(Nz(patientRS(patient.SSN), “”), “@@@-@@-@@@@”)

Also, if the SSN field is a numeric field, change it to a text field.

About this author

Office 2024 - all you need to know. Facts & prices for the new Microsoft Office. Do you need it?

Microsoft Office upcoming support end date checklist.