Social Security Masking on a Form

velcrowe

Registered User.
Local time
Today, 17:47
Joined
Apr 26, 2006
Messages
86
I have a form based on a table where social security numbers are entered. I would like to enter a social security number on the form and once it's entered the first 5 digits are masked. When I go to the table I would like to see the complete social security number displayed. Is this possible? Can the control source on the form be formatted to hide the existing social security numbers as well so they don't have to be rekeyed with the new format?

Thank you in advance:cool:
 
Never had to do this but I would suggest using the OnCurrent event of the form to fire something like this...

txtSSN = "***-**-" & Right([SSN],4)

'txtSSN = the name of your text box
'SSN = the name of the control source for that text box

Searching the forum is a great way to discover and learn the answers to your Access programming questions.

HTH
 
It works to mask the social security number on the form but it also does it to to the corresponding social security numbers on the table. I hope there is a way to show it on the table. Thank you in advance for all your help
 
Oops. I then suggest that you hide the text box if it has a SSN and then have a new label appear on top of the SSN text box. Name the new label "lblSSN" to display the masked SSN. Try something like this in the forms OnCurrent event.

Code:
Private Sub Form_Current()

    If Not IsNull(txtSSN) Or txtSSN <> "" Then
        Me.txtSSN.Visible = False
        Me.lblSSN.Visible = True
        Me.lblSSN.Caption = txtSSN = "***-**-" & Right([SSN], 4)
    Else
        Me.txtSSN.Visible = True
        Me.lblSSN.Visible = False
    End If

End Sub
 

Users who are viewing this thread

Back
Top Bottom