Formatting

G

Guest

Hi,

I am having a really difficult time with access.

All I want to do is export a table to a csv. (I am using Office 2003).
The table has 1 column of data, 100 rows. Data is formatted as "0.###"

The problem is that when I export the values are truncated and you get only a
"0".

I tried going into "design view" and choosing "double", "general number"
this does not work.

Why would the table appear with 3 decimal places in access and then not
export to 3 decimal places?


Thanks for your help.
 
D

Douglas J. Steele

Applying a format through the Format property doesn't change the value: it
just changes how it's displayed in Access.

You could try using the Format function: that actually converts the value to
a string, which could then be exported to your CSV file.
 
G

Guest

Why is the data formatted to "0.###" anyway? I am wondering whether that
might be the problem
 
G

Guest

Yes - that works I change the formula in the table to
Format(Variable, "0.###")
now the csv file has 3 decimal places.

In both cases before and after the field was formatted, the table in access
showed a number with 3 decimal places.

It seems strange that it needs the "format" function to export correctly. I
tried creating a table with 1 column and the number 0.056 in each row.

It would not export to csv with all 3 decimals it was truncated to "0"

I had to type in Format(0.056,"0.###") for it to export correctly.

Thanks for you help on this!
 
D

Douglas J. Steele

Actually, it's not all that surprising.

As I mentioned earlier, Formatting only impacts how it's displayed in
Access. The value may look like 0.056, but internally it may well be
0.557836236. Similarly, it may look like 1.000, but to a computer there's no
difference between 1.000 and 1. Since Access has no idea why you're
exporting to a CSV file, it doesn't know whether the receiver needs the
appearance or the actual value. It's only if you explicitly take matters
into your own hands and use the Format function (which does change the
value) that Access will acquiesce.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top