473,386 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

replace text with XXXX for protection

I have a textbox that holds credit card numbers. I want to be able to print these numbers in a report but to display X's instead of the numbers. Example if the number is like this : 5262 1234 5678 9012 it would print instead like this
XXXX XXXX XXXX 9012.
Please help
Apr 21 '08 #1
6 2319
missinglinq
3,532 Expert 2GB
Place an Unbound textbox on your report and as itsControl source use

=String(Len(Replace(CCN," ",""))-4,"X") & Right(CCN,4)

Where CCN is your field holding the credit card number.

Welcome to bytes!

Linq ;0)>
Apr 21 '08 #2
Stewart Ross
2,545 Expert Mod 2GB
I have a textbox that holds credit card numbers. I want to be able to print these numbers in a report but to display X's instead of the numbers. Example if the number is like this : 5262 1234 5678 9012 it would print instead like this
XXXX XXXX XXXX 9012.
Please help
Hi. There are many ways to do this. The simplest I can think of works if the card number is stored as a text string, and it is to extract the last four characters of the card number using the string function Right.

You can use the following directly in the controlsource property of the textbox in your report, changing the name of the textbox to something different to prevent a circular reference to the name of the creditcard number field:
Expand|Select|Wrap|Line Numbers
  1. ="XXXX XXXX XXXX " & Right$([name of your cardnumber field], 4)
If you use this form of display frequently it is a simple matter to make this a custom function which you can call whenever required:
Expand|Select|Wrap|Line Numbers
  1. Public Function PartialCardnumber(cardnumber as string) as string
  2.     PartialCardnumber = "XXXX XXXX XXXX " & Right$(cardnumber, 4)
  3. End Function
This function would be pasted in to any public code module (those you see when you select the Module tab of your database, or a new module if you don't have any existing public modules). It can be used in your report textbox by placing the following statement in the controlsource property:
Expand|Select|Wrap|Line Numbers
  1. =PartialCardNumber([name of your cardnumber field])
-Stewart

**Edit** Apologies to Linq who replied more or less simultaneously to the same question. Both answers are on similar lines...
Apr 21 '08 #3
missinglinq
3,532 Expert 2GB
Ships passing in the (cyber) night!

;0)>
Apr 21 '08 #4
Thank you for the great ideas. I will try to get them to work.
Apr 22 '08 #5
Worked great. Thank you.
Apr 22 '08 #6
missinglinq
3,532 Expert 2GB
Glad we could help!

Linq ;0)>
Apr 22 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: rbt | last post by:
Here's the scenario: You have many hundred gigabytes of data... possible even a terabyte or two. Within this data, you have private, sensitive information (US social security numbers) about your...
4
by: Dan | last post by:
I've run into an interesting problem, and seemed to have stumped 3 newsgroups and 2 other forums. For some reason when I try to insert a record into a SQL table that has a Text column, the...
0
by: Martin Andersson | last post by:
Hello I have an xml structure (or planing to have) something that will have a structure like this. <event name="XXXX"> <param name="a"\> <param name="b"\> <param name="xxxx"\> </event>
18
by: William Payne | last post by:
Hello, I need to write a program that opens a text file and scans the entire file for a specific line and when that line is found, a particular word on that line is to be replaced. The new word is...
4
by: Michelle A. | last post by:
I have a form that takes in a credit card number, just a series of numbers 1234123412341234. When they get to the "Review" page and display all the information a user has entered, I would like the...
1
by: Propoflady | last post by:
Ok I have a report that lists different contact numbers, phone, fax, email. When I print the report I need a label for example Phone: (xxx) xxx-xxxx but if there is no phone number then I need the...
2
by: Erwin Moller | last post by:
Hi Group, At the moment I am developing a app that uses templates. In the templates I have placeholders like this: Dear ***FIRSTNAME***<br> You have subscribed to ***LISTSUBSRIBE***. etc ...
5
by: buntyindia | last post by:
There is a textbox in which date can be inserted manually or through calendar widget. format is "2007-12-05 12:12:0000" I have to write a script that Identify that the date if entered manually is...
8
by: Jonathan Sachs | last post by:
I'm trying to compose a list of items, each of which consists of text that wraps around a picture at the left margin. The examples I have seen tell me to do it like this: <p><img src="xxxx.jpg"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.