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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wow, newb formatting question 1

Status
Not open for further replies.

Cort

MIS
Apr 16, 2002
154
US
Sorry about this really simple question but I've had a brain freeze:

I'm creating a txt file for a report and the records must be a certain legnth.

ex contract number must be 7 characters.

totext({contractnumber}, "0000000")

works like a charm.

How do I do the same thing for a string?

i.e. the [name] record must be 15 characters long no matter the legnth of the name.

totext doesn't work because it is already a string.

Thanks for the help.
 
Cort,

How about
{contractnumber}[1 to 15].

Assuming that you're starting from the first character on the left of the string.

Thanks
 
Thanks SV that worked great. I believe I understand how your formula works. No totally yet but I'll examine it to try to understand it better. I don't see how:

ReplicateString(" ",15-len(trim({MyTable.MyField}))

returns the number of spaces needed but I'll roll with it.

TheEntertainer I cant use that because the field is nowhere near 15 characters long so I have to fill the unused spaces with 0's.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top