count the spaces in white

  • Thread starter Thread starter Frank Dulk
  • Start date Start date
F

Frank Dulk

Using the function Len(MeuCampo), I noticed that she doesn't count the
spaces in white in the end of the field.
Unhappily I need to know the width of the field with those spaces.
Any help is very well coming.
 
Using the function Len(MeuCampo), I noticed that she doesn't count the
spaces in white in the end of the field.
Unhappily I need to know the width of the field with those spaces.
Any help is very well coming.

So if you have a field of Text type with a size of 50, you want the
answer to always be 50?

Access does not store trailing blanks in Text fields. If you have a
Text field and enter

"Banana"

or

"Banana "

it will throw away the trailing blanks and store exactly the same
value.


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Will it be that there is a form of to incapacitate or to change the pattern?
I need to capture those spaces, that the user will type and I don't know how
many they will be.
 
Will it be that there is a form of to incapacitate or to change the pattern?
I need to capture those spaces, that the user will type and I don't know how
many they will be.

That is going to be a very difficult problem for the user! Do you mean
that you want them to be able to type

Abc
Abc
Abc
Abc

and have these four fields all interpreted and displayed as different
strings?

I *BELEIVE* that you can create a Fixed Char field in an Access table
using the ALTER TABLE statement:

ALTER TABLE mytable
ALTER FIELD fieldname Char(50);

This will change the field from a Text field - which has blanks
removed - to a Char field, which is always 50 bytes long. I do not
know if the Len function will work as you wish though.

Would it be possible for the user to put some character at the end to
indicate that the string is complete, such as this?

Abc\
Abc \
Abc \
Abc \


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
I am using like this for the time being:

To keep the position of the cursor in the variable posCursor
To test


If posCursor > Len(Me.Text0) Then
str = Me.Text0 & space(posCursor - Len(Me.Text0)) 'Dica do Balemberg
Else
str = Me.Text0
End if



The problem can be happened the user to type spaces in the end of the field
and to return the cursor for another position, then the spaces will be
unknown.
 
Back
Top