help with formatting and exporting data

  • Thread starter Thread starter walark
  • Start date Start date
W

walark

I have a table that has a number of decimal fields. I need to export the
table to a text file and have the decimal fields right justified. They keep
coming out left justified. How do I change the justification? I'm trying to
use a spec file, but I can't seem to get it right.
 
Since everything in a text file is text, everything is left justified. A
work around is to add spaces to the beginning of the value. You have to
decide how wide you want the column to be so you know how many spaces to add
depending on the length of the number:
Let's say you want the width of the column to be 14 characters.

In the query builder
SomeNumber: Format([FieldName],Space(14-Len(Format([FieldName],"0.00"))) &
"0.00")

In SQL:
SELECT Format([FieldName],Space(14-Len(Format([FieldName],"0.00"))) &
"0.00") As SomeNumber
 
Back
Top