what to export data to .txt and keep the 6 decimal digits

C

Chi-Kuei Wang

Hi,

I have a database of latitude and longitude, all of which have 6 decimal
digits. I can see all the digits in ACCESS2000. But when I export them to
..txt files. They all shrink to 2 decimal digits. Any help appreciated.

ex: 21.4686978 --> 21.47

Chi-Kuei
 
A

Adrian Jansen

Are you reading the .txt file with a text editor, or looking at it with
something like Excel ? If with Excel, maybe that is set to display only 2
digits ?

Are you sure there is no formatting going on during the export, how are you
doing it ?

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 
C

Chi-Kuei Wang

I am looking it with a text editor.

After you asked, now I notice the format option during the export. All the
digits are now preserved, however, it also exports the forms with those
dashed lines. Can I get all the digits without the form?

Usually I overcome this by copying data from Access to Excel and then save
the data as a.txt file. This one dataset that I have has more rows than
Excel can handle(>65000).

Chi-Kuei
 
A

Adrian Jansen

You will have to explain more about exactly what you are doing to export. I
presume you mean 'format' when you say 'form'. Unfortunately 'form' has an
entirely different meaning in Access, and it is not clear what you mean.

Are you exporting just the data from a table, or an actual Access Form
object ?

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 
C

Chi-Kuei Wang

I should have been more careful about my wording. Yes, I only want to export
data from a table.

So here is what I did.
1. For example I have a table in a database like this
field1 field2
157.123456 -27.125485
157.123356 -27.125475
.... .....
2. I click on File->Export... . I then assigned a file name and chose "text
files(*.txt; *.csv; *.tab; *.asc)" as my file type. I also selected "save
formatted". The result is shown below.
---------------------------------
| field1 | field2 |
---------------------------------
| 157.123456 | -27.125485 |
---------------------------------
| 157.123356 | -27.125475 |
---------------------------------

There is no fancy technique involved.

Thanks,

Chi-Kuei
 
A

Adrian Jansen

Ok, now I see what you are doing. And yes, there seems to be some automatic
limiting of the export to text format to 2 decimal places when you export
directly from a table with numerics.

To get around this, create a query based on the table. Drag in all the
fields you want. Set each field to the expression
DummyName:Format(FieldName,"#.######")
where DummyName can be any name, and FieldName is the actual name in your
table. The string "#.######" converts the numeric to a text string with at
least 6 decimal places - you can set the number to suit.
Save the query.
Then base your export on that query, rather than the table itself.
You dont need to save "formatted" in that case, and you can adjust with the
export wizard what delimiters and separators to use. Note that because you
are exporting strings, Access tries to wrap each string in " marks. You can
turn these of if necessary.

Hope this helps.

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 
C

Chi-Kuei Wang

Yes, it works!! Thanks a lot.

Chi-Kuei


Adrian Jansen said:
Ok, now I see what you are doing. And yes, there seems to be some automatic
limiting of the export to text format to 2 decimal places when you export
directly from a table with numerics.

To get around this, create a query based on the table. Drag in all the
fields you want. Set each field to the expression
DummyName:Format(FieldName,"#.######")
where DummyName can be any name, and FieldName is the actual name in your
table. The string "#.######" converts the numeric to a text string with at
least 6 decimal places - you can set the number to suit.
Save the query.
Then base your export on that query, rather than the table itself.
You dont need to save "formatted" in that case, and you can adjust with the
export wizard what delimiters and separators to use. Note that because you
are exporting strings, Access tries to wrap each string in " marks. You can
turn these of if necessary.

Hope this helps.

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 

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