remove first three 000 in the field?

C

Cam

Hello,

I have a query with field that have 000 in the beginning of a 9 digits number.
What function in query to use to return the value less the first three 000?
Thanks
 
M

Michel Walsh

If it is always three zeros, then:



SELECT MID( fieldname, 4 )
FROM tableName



Vanderghast, Access MVP
 
B

Brett Stone

Change the field from a text field to an integer and those preceeding 0's
will disappear. If you want to keep it a string then right([fieldname], 6)
should give you the right 6 digits of the field without the 3 0's.
-B
 
A

AMITA

Michel.
I am trying to extract the birth year from a field that has month, date and
year of birth as a text. How can I run a query where only the year is
extracted. Or where the year of birth is used to generate age.
 
M

Michel Walsh

YEAR( CDATE( " January 2, 1995" ))


returns 1995, so, maybe you can try:


YEAR(CDATE( yourFieldOrExpression ))



Vanderghast, Access MVP
 
J

John W. Vinson

Michel.
I am trying to extract the birth year from a field that has month, date and
year of birth as a text. How can I run a query where only the year is
extracted. Or where the year of birth is used to generate age.

What's the actual format of your field? Is it a text date such as "January 14,
1962" or a number string such as "19620114" or what?
 

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