Storing trailing space in text fields

  • Thread starter Thread starter Charlie Mac
  • Start date Start date
C

Charlie Mac

Access Gerus,

How can I get Access to save text into a field to include a trailing
space if I don't want to use quotes? I have tried the field's format
(space) option to no avail. What am I missing?

Thanks,

Charlie from Texas
 
Could you explain why you need to store a trailing space? It seems like a
waste of disk space to me.
 
Access Gerus,

How can I get Access to save text into a field to include a trailing
space if I don't want to use quotes? I have tried the field's format
(space) option to no avail. What am I missing?

Thanks,

Charlie from Texas

It's generally a Bad Idea - having two fields containing

ABC

and

ABC

and insisting that they be treated differently leads to all sorts of
hassles.

That said...

you can run a DDL query

ALTER TABLE foo
ALTER COLUMN bar CHAR(25);

to set the field [bar] to a fixed-length 25 character field with
trailing blanks.

John W. Vinson[MVP]
 
If what you REALLY need is a way to display your field plus a trailing
space, store the text without the space and add the space by using a query
when you get ready to export it or display it.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
I'm with Jeff on this one. It is much the same as storing calculated values.
To present the data in the field with trailing spaces, here is a formula
that will work. Let's assume we want the value to be 20 characters in length:

= strTwentyOnly & Space(20 - Len(strTwentyOnly))
 
Back
Top