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

Counting characters entered in a field

Status
Not open for further replies.

jpm2275

Technical User
Jul 13, 2004
1
US
Does anyone know how to figure out how many characters are in a field using a query? Ex: 345 would return 3, 34567 would return 5. I’m using the length expression, but it’s only returning the field length (which is preset). It’s not counting the characters.

Thanks
 
Perhaps Len(Trim([Field name] & ""))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
you could try this. len(ltrim(rtrim(field)))

or if the Trim function is valid you could replace both the ltrim and rtrim with just Trim.

This will remove the padding and give you the lenght of characters.
 
I suppose it would help to actually give you an example...
Code:
Select len(ltrim(trim(FIELD_NAME))) as Expr1 From TABLE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top