Auto populate last_5_SSN from FULL_SSN

SFCMatthews

Registered User.
Local time
Today, 03:28
Joined
Feb 3, 2012
Messages
44
I have 2 fields Full_SSN wich is the IDKEY for the table and a last_5_SSN field. How do I auto populate Last_5_SSN while imputing the full_SSN?
 
You shouldn't have a last_5_SSN field in your table. You don't store values that can be determined from your data. What you do is create a query and then use the Right() function (http://www.techonthenet.com/access/functions/string/right.php) to get the last 5 characters of the SSN:

last_5_SSN: Right(Full_SSN, 5)

On a form you could do the same using an unboud input field that uses the same method.
 
A question: do you want the last five Digits from the SSN?

Social Security Numbers are generally written/entered

XXX-XX-XXXX

so using

last_5_SSN: Right(Full_SSN, 5)

against a SSN entered in this fashion will yield

-XXXX

There's not much advantage to returning a Hyphen plus 4 Digits instead of simply 4 Digits.

If you actually want the last 5 Digits, and you're not sure if the users wil enter XXX-XX-XXXX or simply XXXXXXXXX you'd need something like:

Right(Replace(Full_SSN,"-",""),5)

Linq ;0)>
 
Last edited:
I tryed it and I get 00001 not 0-0001. I am going to look at the properties and see if I can set the format like you can on the tables for SSN. Thank you again !
 
Thank you for your help. I ended up putting a expression in my query’s using the expression you showed me. I then adding unbounded text box to the reports and forms and I adjusted the input mask with 0\-0000;0;_ and that worked. :)
 

Users who are viewing this thread

Back
Top Bottom