Storing trailing space in text fields


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
 
Ad

Advertisements

R

ruralguy via AccessMonster.com

Could you explain why you need to store a trailing space? It seems like a
waste of disk space to me.
 
J

John Vinson

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]
 
J

Jeff Boyce

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
 
Ad

Advertisements

G

Guest

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))
 

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

Similar Threads


Top