# Hiding characters in a Microsoft Access Report

**URL:** <https://boards.straightdope.com/t/hiding-characters-in-a-microsoft-access-report/700171>\
**Category:** Factual Questions\
**Created:** [October 2, 2014, 11:00am UTC](https://boards.straightdope.com/t/hiding-characters-in-a-microsoft-access-report/700171 "2014-10-02T11:00:54Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![StusBlues](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@StusBlues](https://boards.straightdope.com/u/StusBlues)\
**Post date:** [October 2, 2014, 11:00am UTC](https://boards.straightdope.com/t/hiding-characters-in-a-microsoft-access-report/700171/1 "2014-10-02T11:00:54Z")

</div>

I’ve inherited a good number of Access reports at work. Several of them display credit card numbers (e.g., “4111222233339999”), and I’ve been tasked with converting some of them to display only the last four digits (e.g., “\*\*\*\*\*\*\*\*\*\*\*\*9999”). What is the quickest way to do this? Is there a setting I can adjust on the field in the report itself, or do I need to make the change in the query?

Thanks so much.

---

<div class="post-metadata">

**Author:** ![Mangetout](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mangetout/32/19_2.png) [@Mangetout](https://boards.straightdope.com/u/Mangetout)\
**Post date:** [October 2, 2014, 12:15pm UTC](https://boards.straightdope.com/t/hiding-characters-in-a-microsoft-access-report/700171/2 "2014-10-02T12:15:57Z")

</div>

You could do this with an expression that will be something like:  
=“\*\*\*\*\*\*” & Right([fieldname],4)

But there’s a potentially bigger problem - storing the card numbers intact in your DB is probably a serious security risk and (depending on the nature of your business) may put you in breach of Payment Card Industry standards ([Payment Card Industry Data Security Standard - Wikipedia](http://en.wikipedia.org/wiki/Payment_Card_Industry_Data_Security_Standard))

---

<div class="post-metadata">

**Author:** ![Telemark](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/telemark/32/372_2.png) [@Telemark](https://boards.straightdope.com/u/Telemark)\
**Post date:** [October 2, 2014, 12:16pm UTC](https://boards.straightdope.com/t/hiding-characters-in-a-microsoft-access-report/700171/3 "2014-10-02T12:16:55Z")

</div>

Unless you have a real reason for retaining the CC numbers you’re better off actually changing those records rather than just changing the display properties. In general, there’s no upside to retaining CC numbers and a HUGE downside to doing so.

If you do decide to keep them I don’t know how to change the display properties, sorry.

---

<div class="post-metadata">

**Author:** ![Mangetout](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mangetout/32/19_2.png) [@Mangetout](https://boards.straightdope.com/u/Mangetout)\
**Post date:** [October 2, 2014, 12:24pm UTC](https://boards.straightdope.com/t/hiding-characters-in-a-microsoft-access-report/700171/4 "2014-10-02T12:24:19Z")

</div>

I think you can also do this with display masks in the report, but that’s the sort of thing that breaks when you move to a new version of Access, and all of a suddenly, the whole number is there for all to see.

But yes, all the time you have the whole numbers in your DB, there’s a risk they will be accidentally revealed on a report, accidentally viewed by someone looking at the table, accidentally leaked to the outside world.

---

<div class="post-metadata">

**Author:** ![StusBlues](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@StusBlues](https://boards.straightdope.com/u/StusBlues)\
**Post date:** [October 2, 2014, 12:26pm UTC](https://boards.straightdope.com/t/hiding-characters-in-a-microsoft-access-report/700171/5 "2014-10-02T12:26:48Z")

</div>

> [@Mangetout](#):
>
> You could do this with an expression that will be something like:  
> =“\*\*\*\*\*\*” & Right([fieldname],4)
> 
> But there’s a potentially bigger problem - storing the card numbers intact in your DB is probably a serious security risk and (depending on the nature of your business) may put you in breach of Payment Card Industry standards ([Payment Card Industry Data Security Standard - Wikipedia](http://en.wikipedia.org/wiki/Payment_Card_Industry_Data_Security_Standard))

The DB itself is encrypted. We have a team upstream of me addressing PCI concerns.

---

<div class="post-metadata">

**Author:** ![Mangetout](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mangetout/32/19_2.png) [@Mangetout](https://boards.straightdope.com/u/Mangetout)\
**Post date:** [October 2, 2014, 12:39pm UTC](https://boards.straightdope.com/t/hiding-characters-in-a-microsoft-access-report/700171/6 "2014-10-02T12:39:17Z")

</div>

Still sounds risky, but OK - here’s the least worst plan I can think of:

[ul]  
[li]Create a query based on the table that contains the card numbers[/li][li]Include every field in the query grid, except the card number[/li][li]When you add the card number to the grid, add it by means of an expression like the one in post #2\*[/li][li]Never use the raw table in any other query or report anywhere again - only ever use the query you just made instead[/li][li]Find every existing place the raw table is used, and substitute it with your query (Queries can be treated exactly like tables in Access)[/li][/ul]  
\*so if your field is called ‘CardNum’, use:

```auto

MaskedCardNum: " ******" & Right([CardNum],4)

```

---

<div class="post-metadata">

**Author:** ![yoyodyne](https://avatars.discourse-cdn.com/v4/letter/y/a9a28c/32.png) [@yoyodyne](https://boards.straightdope.com/u/yoyodyne)\
**Post date:** [October 2, 2014, 1:21pm UTC](https://boards.straightdope.com/t/hiding-characters-in-a-microsoft-access-report/700171/7 "2014-10-02T13:21:44Z")

</div>

I don’t see the point in reporting a bunch of asterisks over and over again. Just label the card column “CC Last Four” and use that.

---

<div class="post-metadata">

**Author:** ![Mangetout](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mangetout/32/19_2.png) [@Mangetout](https://boards.straightdope.com/u/Mangetout)\
**Post date:** [October 2, 2014, 1:49pm UTC](https://boards.straightdope.com/t/hiding-characters-in-a-microsoft-access-report/700171/8 "2014-10-02T13:49:31Z")

</div>

Agreed (that’s why I used a smaller quantity of stars, but your idea is better).

---

<div class="post-metadata">

**Author:** ![Mangetout](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mangetout/32/19_2.png) [@Mangetout](https://boards.straightdope.com/u/Mangetout)\
**Post date:** [October 2, 2014, 2:01pm UTC](https://boards.straightdope.com/t/hiding-characters-in-a-microsoft-access-report/700171/9 "2014-10-02T14:01:55Z")

</div>

so that expression would just be:

```auto

CCLastFour: Right([CardNum],4)

```

---

<div class="post-metadata">

**Author:** ![StusBlues](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@StusBlues](https://boards.straightdope.com/u/StusBlues)\
**Post date:** [October 2, 2014, 5:15pm UTC](https://boards.straightdope.com/t/hiding-characters-in-a-microsoft-access-report/700171/10 "2014-10-02T17:15:40Z")

</div>

Thanks.
