Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forcing fixed length in text fields 1

Status
Not open for further replies.

jacq

Technical User
Jan 3, 2001
38
GB
I have a table with text fields with entries of various lengths. I need to create a string with each field containing 30 characters. Can I force a fixed length so any entry less than 30 characters has spaces to make it up to 30?
 
yes, use
FieldName & Space(30-Len(FieldName))
or
Space(30-Len(FieldName)) & FieldName

PaulF
 
Of course, PaulF is correct. However I would like to know why/where you find it necessary to pad the field to the fixed length.

Also, if you store the LEADING spaces (as in PaulF's second function) in an Ms. Access TEXT table!field, they will be retained, however this is not recommended.



MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
I need to produce a string of a fixed length combining data from several fields to export to Academy Remit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top