Space character in a field

wutaguy

Registered User.
Local time
Today, 00:43
Joined
Sep 6, 2005
Messages
10
Hi!
I have a field that has to be 20 Characters long. Most of the time data for this field is less than 20 characters, so the remaining has to be filled with spaces to make it 20. e.g. if there is a record xyz1234567, then the rest of the record should have 10 spaces like xyz1234567ssssssssss, meaning if i click on this record then the cursor should not blink after 7 but after the spaces. Hope I am making sense.
Thanks for any input.
 
Hi -
Lookup the Space() function in the help file. Here's how you could use it in an update query:

Code:
UPDATE YourTbl SET YourTbl.YourFld = RTrim([YourFld ]) & Space(20-Len(RTrim([YourFld ])));

Replace instances of 'YourTbl' with your table name and 'YourFld' with your field name and it should fly. Backup your database before testing ('...just in case.')

Tested in A97.

HTH - Bob
 

Users who are viewing this thread

Back
Top Bottom