PRINT statement question

  • Thread starter Thread starter Tcs
  • Start date Start date
T

Tcs

As I'm processing my data file, I'm writing out a log file to keep a record of
any errors. I'm including the record number of the offending input record. I'd
like to make it easier to read by formatting the record number, if possible.
Ideally, I'd like to print the number "123456" as "123,456" and be right
justified.

Is this possible? And if so, how?

Thanks so much,

Tom
 
Tcs said:
As I'm processing my data file, I'm writing out a log file to keep a record of
any errors. I'm including the record number of the offending input record. I'd
like to make it easier to read by formatting the record number, if possible.
Ideally, I'd like to print the number "123456" as "123,456" and be right
justified.


Use the Format function to format the value:

Print ..., Format(recno, "#,##0"), ...
 
Thanks, don't know how I couldn't find this...

Just tested it. It *is* an improvement. Now I have a comma. But it doesn't
right justify it. Oh well...
 
Marshall Barton said:
Use the Format function to format the value:

Print ..., Format(recno, "#,##0"), ...

As for the right justification, if you know how wide the print area is, you
can pad the output of the Format statement. Assuming that you're printing 80
columns to the file, try something like:

Print ..., Right$(Space$(80) & (Format(recno, "#,##0"), 80)
 
Back
Top