Determine character length in field

A

alecgreen

Hi, I am trying to determine the actual number of characters within a
field [CustomerAnalysisCode]. The field length from the underlying
table is 2, I have tried Length: Len([CustomerAnalysisCode]), but this
alway returns 2 Irrelevant of the the actual number of characters: for
example "7" returns 2 as well as "07"

Many Thanks

Alec
 
R

raskew via AccessMonster.com

Alec-

If there can be up to seven (or whatever) characters, then you need to change
the underlying field length to correspond.

Bob
Hi, I am trying to determine the actual number of characters within a
field [CustomerAnalysisCode]. The field length from the underlying
table is 2, I have tried Length: Len([CustomerAnalysisCode]), but this
alway returns 2 Irrelevant of the the actual number of characters: for
example "7" returns 2 as well as "07"

Many Thanks

Alec
 
J

John Spencer

Try trimming the field. It appears that your data source allows leading
or trailing spaces. You can get trailing spaces in Access Jet databases
if you programatically populate the field or if you are linking to an
external source that allows trailing spaces or an external source that
forces spaces into a field so the field contents are all the same length.

Field: TheLength: Len(Trim(CustomerAnalysisCode))



'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 

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