Need to show only the last four digits of SS# on report

G

Guest

I'm trying to run a report from a query. The query shows the full social
security number, but on the report I need to only show the last four number.
Any suggestions?
 
G

Guest

Use "Right" in vb.

Here's an example...

Dim stSocial, stPartial

stSocial = Me.YourSocialField
stPartial = Right(stSocial, 4)

Me.MyReportField = "XXX-XX-" & stPartial

HTH

Aaron G
Philadelphia, PA
 
G

Guest

Rob, thanks for your input, but when I tried it, nothing on the report
showed. What am I doing wrong? I entered right([ssn],4) in the criteria
under the SS# column. Am I putting the formula in the wrong place? I really
appreciate your suggestions.
 
R

Rick B

Just add an unbound text box to your report and put the following in it...

= Right([SSN],4)
 
F

fredg

Rob, thanks for your input, but when I tried it, nothing on the report
showed. What am I doing wrong? I entered right([ssn],4) in the criteria
under the SS# column. Am I putting the formula in the wrong place? I really
appreciate your suggestions.

jeckels1 said:
I'm trying to run a report from a query. The query shows the full social
security number, but on the report I need to only show the last four number.
Any suggestions?

Yes you did this in the wrong place.
Do it in the report itself.
Add an unbound control where you wish to display the SS#.
Set it's control source to:
=Right([SSN],4)
or set it to:
="xxx-xx-" & Right([SSN],4)

depending upon how you would like to display it.

Change SSN to whatever the actual name of the Social Security field
is.
 
D

Douglas J Steele

Yes, you're putting it in the wrong place. You don't want it as a criteria,
you want it as a new computed column. Either that, or you use it as the
Control Source for your text box.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


jeckels1 said:
Rob, thanks for your input, but when I tried it, nothing on the report
showed. What am I doing wrong? I entered right([ssn],4) in the criteria
under the SS# column. Am I putting the formula in the wrong place? I really
appreciate your suggestions.

jeckels1 said:
I'm trying to run a report from a query. The query shows the full social
security number, but on the report I need to only show the last four number.
Any suggestions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top