Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I hide a SSn except the last 4 digits 1

Status
Not open for further replies.

LittleNick

Technical User
Jun 26, 2009
55
US
Greeting,
What I am trying to accomplish is I have a form that users enter their information and one of the text box is for Social Security number. I want to make this box in a way when the user enter the first five digits it would shows "X" except for the last 4 so that their sensitive info is not displayed completely (as XXX-XX-1234, like a Credit cards # that shows only last 4 digits), but then it would store all 9 digits in the SQL table. Any helps would be greatly appreciated.
 
is this for data entry or data viewing?

i.e. are they entering the full number and then the form would automatically hide the beginning bit afterwards while they continue to enter data?

or do you mean they enter the number then save, then when someone is viewing the forms data they only see the last 4 numbers?

sorry if what you said explains this but i couldnt quite work it out.

It's not what you know. It's who's on Tek-Tip's
 
using your credit card example when i have used other programs/websites for entering credit card info you enter the card details in full and this remains shown in full until you save the data, then when you view your details only then does it hide the beginning part of the number.

if this is the case you would just use something like this to show only the last 4 digits

right([social_num],4)



It's not what you know. It's who's on Tek-Tip's
 
How are ya LittleNick . . .

I believe [blue]overdraft015[/blue] means:
Code:
[blue]   "XXX-XX-" & right([social_num],4)[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thanks overdraft015 and TheAceMan1 for your response.
Sorry, I may not have been clear. To answer overdraft015 questions, what I intend to do is the users would enter the social security number (in the format 000-00-0000) and it is store into a SQL table (Control Source property is bound to social_num field of SQL table), then as soon as they are done entering it, when they tab down or when they press enter, the social security number then would automatically change it to XXX-XX-0000 (0000 being the last 4 digits that were previously entered).

Let me try to use "XXX-XX-" & right ([social_num], 4) in the AfterUpdate() event. I just have one though before I try this. would it over write the value of the social security number if I set something like this?
Me.SocialSecurityNum.Value = "XXX-XX-" & right([social_num],4).
Thanks for your helps.
 
thanks TheAceMan1 for the catch.

yes littlenick it would overwrite the initial value entered.

you could have 2 overlapping fields

1st is bound to your social_num field and is not locked for editing
2nd is overlapped and hidden (visable = false) and is bound to ="XXX-XX-" & Right([social_num],4)

then afterupdate on the first field... set it to hide the first field and show the second



It's not what you know. It's who's on Tek-Tip's
 
btw social_num in the ="XXX-XX-" & Right([social_num],4) is the name of the text box not the field name in the sql.


It's not what you know. It's who's on Tek-Tip's
 
Thanks for your helps overdraft015. Your solution with 2 overlapping fields seems to solve my problem. And thanks for clarifying the textbox name and the SQL table field name.

Also thanks to theAceMan1.

have a great day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top