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!

Truncation of decimal places in table export

Status
Not open for further replies.

fastrunr

Technical User
Nov 4, 2004
35
US
Hi -

I'm trying to export a table to a csv file (via exporting to Excel and then saving as csv), and am finding that numbers are being truncated from 15 to 9 decimal places.

Any tips on preserving the decimal places?

thanks,
Liz

PS - sorry if this one's already been covered; I searched, but could'nt find it...
 
Two things:

1. Your full fifteen-DP value is exported, I would say, it's just being displayed differently in Excel - try highlighting a cell in Excel, clicking Format, Cell and selecting Number format with 15 decimal places and all will be well.

2. Why not export direct to CSV rather than to XLS first, then doing a Save As. The files required to export to CSV files direct from Access may not have been installed as part of your default installation of Office but they will be there on your original installation discs. Run Office Setup from Add/Remove Programs to add this extra in, then export direct to CSV.

Hope this helps.

[pc2]
 
I've had similar issues in exporting tables... my solution was to create a query and use the Format() fucntion to display the correct number of decimals... then export that query... htwh,

Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
smedvid - a small example would be very helpful. got any code you can share?
 
Table1
ID Field1_5_3 Field2_10_5
1 12.345 12345.67891
2 22.123 11223.12345
3 12.1 11.1

Export Table1 to csv - (2) DEcimals only!
1,12.34,12345.67
2,22.12,11223.12
3,12.10,11.10

Create SQL Query1
SELECT Table1.ID, Format([Field1_5_3],"#.000") AS Expr1, Format([Field2_10_5],"#.00000") AS Expr2
FROM Table1;

Export Query1 - All Decimals appear....
1,"12.345","12345.67891"
2,"22.123","11223.12345"
3,"12.100","11.10000"

I think I reviewed FormatNumber also worth looking at...
Again, this worked for me... Not knowing your application or export needs... htwhm,





Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top