Query to Display Partial Field?

S

Steve-O

How would one build a query to display only the last four
digits of someone's SS# even though the field actually
has all nine digits?

Thanks
 
M

Michel Walsh

Hi,


If it is a number, you can integral divide, \ , by 100 000

? 987654321 \ 100000
9876



Hoping it may help,
Vanderghast, Access MVP


Fredg said:
LastFour:Right([SS#],4)

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Steve-O said:
How would one build a query to display only the last four
digits of someone's SS# even though the field actually
has all nine digits?

Thanks
 
S

Steve-O

Many thanks
-----Original Message-----
LastFour:Right([SS#],4)

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Steve-O said:
How would one build a query to display only the last four
digits of someone's SS# even though the field actually
has all nine digits?

Thanks


.
 
S

Steve-O

Okay, what am I doing wrong? Thanks!

SELECT [EMPLOYEE INFO].[Employee Name], [EMPLOYEE
INFO].SSN
FROM [EMPLOYEE INFO]
WHERE ((([EMPLOYEE INFO].SSN)=LastFour:Right([SSN],4)));




-----Original Message-----
LastFour:Right([SS#],4)

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Steve-O said:
How would one build a query to display only the last four
digits of someone's SS# even though the field actually
has all nine digits?

Thanks


.
 
M

Michel Walsh

Hi,



Try, instead:



SELECT *
FROM [Employee Info]
WHERE ssn LIKE [Enter the first four digits of the SSN: ] & "*"


or


SELECT [Employee Name], Left( ssn, 4) As FirstFour
FROM [Employee Info]


The first query acts like a filter (display only the SSN that starts
with the first four given number as parameter), while the second just
display the first four digits of the SSN (such as for some security
reasons). It is not clear what you want to do between those two options.


Hoping it may help,
Vanderghast, Access MVP



Steve-O said:
Okay, what am I doing wrong? Thanks!

SELECT [EMPLOYEE INFO].[Employee Name], [EMPLOYEE
INFO].SSN
FROM [EMPLOYEE INFO]
WHERE ((([EMPLOYEE INFO].SSN)=LastFour:Right([SSN],4)));




-----Original Message-----
LastFour:Right([SS#],4)

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.


Steve-O said:
How would one build a query to display only the last four
digits of someone's SS# even though the field actually
has all nine digits?

Thanks


.
 

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