Skip to content

Masking Credit Card Numbers

A reader wants to know how to create a mask for a credit card.

Q:  Melody Overstreeet writes:  “How do you create a mask for a credit card?  I want the last for digits to show and the rest I want to be an *”

A:  I like to use the expression below in a query; the SecureCreditCardNo field can then be placed on a form or report:

SecureCreditCardNo: IIf([CreditCardNo]<>“”,”********” & Right([CreditCardNo],4),””)

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.