Formatting string

J

John

Hi

How can I format a string in format xxx xxxx xxxx ie 3 chars then space then
4 chars then space then 4 chars? This should work even if there are
insufficient characters.

Thanks

regards
 
M

Marshall Barton

John said:
How can I format a string in format xxx xxxx xxxx ie 3 chars then space then
4 chars then space then 4 chars? This should work even if there are
insufficient characters.


Set the Format to:
!@@@ @@@@ @@@@

Drop the ! if you want to fill from the right when there are
insufficient characters
 
J

John

Hi Marsh

Thanks for that. Anyway to strip the spaces in the original string before
the formatting is applied? Right now if the user enters any spaces they are
messing up the formatted string.

Thanks

Regards
 
M

Marshall Barton

If you don't need to edit the value, then set the text box's
control source to =Replace(thefield, " ", "")
and make sure the text box's Name isdifferent from the
field's name.

If you do want to edit the field, you will have to remove
the spaces in the table.
 
Top