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

? Which Function 1

Status
Not open for further replies.

WingandaPrayer

Technical User
May 15, 2001
152
I have a field with 9 digits.
I want to show the first 5 digits.

000010055
to
00001

Thank you

David
 

If the column is a text filed use the LEFT function.

SELECT LEFT(colname,5) As NewColname

If the column is numeric, you will need a combination of functions - FORMAT and LEFT.

Select LEFT(FORMAT(colname,"000000000"),5)

Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it and comment if you have time.
NOTE: Reference to the FAQ is part of my signature and is not directed at any individual.
 
Terry,
Thanks for the reply.

It is a text field,imported from excel into a table.
Text field due to a few references being aplhanumeric.

The query
SELECT lsvtprop.PropRef, Left([PropRef],5) AS RefOnly
FROM lsvtprop;

It comes up compile error
What's this idiot doing wrong !!!!!


David

 

What's the error? And which version of Access are you using? Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it and comment if you have time.
NOTE: Reference to the FAQ is part of my signature and is not directed at any individual.
 
You may be missing References. Check this article.

Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it and comment if you have time.
NOTE: Reference to the FAQ is part of my signature and is not directed at any individual.
 
Access97.
compile error in query expression 'Left([PropRef],5)'

error 3075 ........are field names and punctuation correct.



Thanks

David
 
Terry,

Regarding missing references.
I know Calendar control? has disappeared since the hard drive has been re-formatted.Waiting for disk from IT.
Would this cause the problem?
Other PC's in the office also missing Calendar control.

Thanks

David
 

Maybe Access 97 requires the use of LEFT$ rather than LEFT. I can't remember. I used to use the $ on these functions all the time but now rutinely omit it.

Sounds like you may actually be missing an OCX or DLL file for the calendar control. Have you tried reinstalling OFFICE to correct any problems? Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it and comment if you have time.
NOTE: Reference to the FAQ is part of my signature and is not directed at any individual.
 
Terry,

Thanks for your time.
I'll have to wait for our IT department to reload office.
Just looking for original excel workbook to change to 5 digits then import.

Thanks again

David
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top