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

Export Text File with Trailing Zeros

Status
Not open for further replies.

Bonediggler1

Technical User
Jul 2, 2008
156
US
Hi-

I am trying to export the contents of a table to a text file. One of the fields contains dollar amounts. If I specify in the table the format to be Double/Fixed/Two decimal points, all values show correctly in the table...i.e. 1 becomes "1.00" and so forth. However, when exporting this table, the trailing zeros are dropped. If I query the table, change this field to text in the query and then export via VBA, the trailing zeros are dropped. If I manually export this query, the trailing zeros are maintained...

Not sure what I'm missing here. I am obviously trying to keep the trailing zeros when exporting.

Please advise...

Thank you!!
 
Hi,

So what's different in the VALUES of

.1
or
.1000

???

Leading and trailing zeros are merely FORMATTING. However, you may have a point if the file is being used as input data for a program that NEEDS the leading or trailing zeros or it will ABEND.

What's the bottom-line requirement?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
In your query, do you have a column defined like:
Code:
DollarsTxt: Format([Dollars],"Fixed")
I found that whether you export manually or via DoCmd.TransferText, whether the export is delimited or undelimited, it always includes two digits to the right of the decimal point so long as you use the above field definition. I am using Access 2007.

Regards,
Lisa
 
SkipVought: Yes, the file will be uploaded into an A/R system that requires all dollar amounts to have 2 digits to the right of the decimal.

LisaWay: I am using Access 2003 but will try your suggestion and see what happens...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top