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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print only portion of field

Status
Not open for further replies.

tdejournett

IS-IT--Management
Jul 4, 2002
6
US
I have a database with social security numbers on it. I want to print lables with only the last 6 digits of each employees social security number to print out on the label. Can some one please help me.

Thanks,
T.D.
 
[tt]
Hi:

Convert the social security number to a string. Use the Right() function to return the characters you want from the right side of the string.

Dim ssnString As String
Dim prtString As String
'converts number to string
ssnString = Str(Me.SSN)
'returns right 6 characters of the new string
prtString = Right(ssnString,6)


Hope this works for you.

Cheers, [glasses][tt] Gus Brunston - Access2000(DAO)[/tt] Intermediate skills.
 
[tt]
Ha!

I guess you could divide the social security number by 100,000, and print only the decimal from the result. Not sure of the functions to do that... [glasses][tt] Gus Brunston - Access2000(DAO)[/tt] Intermediate skills.
 
As long as there are no spaces in between numbers you can use the following code:

RptSocSec = Right([SocialSec#],6)

Of course you'll have to replace 'RptSocSec' with your own report field name and '[SocialSec#]' with your own source.

It can still be done if you have spaces between numbers but the code will obviously be slightly more complicated ;-)
[yinyang]
 
[tt]
Hi, Shannon:

I didn't know that!

Thanks, [glasses][tt] Gus Brunston - Access2000(DAO)[/tt] Intermediate skills.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top