This way, no matter what your users enter into the field, after updating, it will contain the data plus a space. Doing this to a memo field would work the same.
It sounds like you want a column of the CHAR type - by default Access uses the VARCHAR type. the difference is that a CHAR field of size 5 will always use the whole 5, i.e. if you input "one" it will store "one "; where as VARCHAR of size 5 will use up to 5, i.einput "one" it will store "one". trouble is I dont think that Access will let you change this in the table design view - good news is you can use SQL to do it, i.e.
Code:
ALTER TABLE YOUR_TABLE
ALTER COLUMN YOUR_COLUMN CHAR(5)
switch YOUR_TABLE for the name of your table, switch YOUR_COLUMN for the name of the column you want to change and instead of 5 put whatever length you want the string to be. you can alter as many columns in the table as you want at once, just seperate them with columns. To write SQL directly into a query click on new, cancel the add table and change the view to SQL (icon under file in the top left hand tool bar)
ALTER TABLE table {ADD {COLUMN field type[(size)] [NOT NULL] [CONSTRAINT index] |
CONSTRAINT multifieldindex} |
DROP {COLUMN field I CONSTRAINT indexname} }
This field is usually either empty, or contains more than 5 characters. If it has any data in it, I want to have a single trailing space at the end (a full stop and then space actually, but the "." is the easy bit).
The reason is that I am using this to power a mail merge in word, and two fields of the table are printed next to one another, effectively forming two sentences in a single paragraph.
From the mail merge side I can supress any blank records (most of them), but where there is data, I want a space before moving to the new sentence.
...and just to pre-empt - a leading space in the second field doesn't work, since this puts a space in, even if the first field is empty and thus not printed.
Thanks Craig - incorrect brackets, but yes, that was the obvious solution - especially since I was (as always) running of queries rather than tables direct.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.