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

transferText number format 1

Status
Not open for further replies.

Naug

Technical User
Sep 24, 2004
85
RU
when I create the specification for docmd.TransferText it shows me my numbers without decimal places, however when I actually export the table it adds two zeroes to each number. How do I best explain acces that that I do NOT appreciate it adding decimal places when not asked to.
 
Almost certainly the app you are exporting TO that is adding the decimals

Rgds, Geoff

"Having been erased. the document thjat you are seeking. Must now be retyped"

Please read FAQ222-2244 before you ask a question
 
Naug,

The number of decimal places is a FORMATING issue and has nothing at all to do with the VALUE.

As Geoff suggested, it is likely your other application.

Skip,

[glasses] [red]Be advised:[/red] Researchers have found another Descartes trueism, "Cogito ergo spud."
"I think; therefore, I YAM!
[tongue]
 
odd, never would have thought that NOTEPAD would add decimal zeroes... Actually I am still doubtfull of that.

Note that I am exporting from a query, not a table.
 
What is the Field Type of the data that is being exported with decimal places?

You could format
[tt]
Format(MyNumericField,"0")
[/tt]


Skip,

[glasses] [red]Be advised:[/red] Researchers have found another Descartes trueism, "Cogito ergo spud."
"I think; therefore, I YAM!
[tongue]
 
floating double (should be int, but dont have control over that).

Where should I put that format code? To elaborate on my example I am creating sql string in the module, then create queryDef object, assign an existing query object to it, change that objects sql through queryDef, then do textTransfer with that modified query object.

the code itself gets info from lots of tables (which all have the same format)
 
err, and once again - when I export that same query manualy and go to specification it shows me in preview that there arent any decimal zeroes
 

Decimal places assumed because you have a floating point value!

In the Select caluse...
Code:
sql = "Select Format(MyNumericField,"0") "


Skip,

[glasses] [red]Be advised:[/red] Researchers have found another Descartes trueism, "Cogito ergo spud."
"I think; therefore, I YAM!
[tongue]
 
ok it works. TY.

btw that format stuff is standart sql or access "feature"?

On side note the behavior of transferText when called with inappropriate specification (for example in my case as the fields lost their names previous specification became dated) is... disturbing. It tells me that such file (which I want to write to) is not found and... deletes it.
 
btw that format stuff is standart sql or access "feature"?
Access feature.
A more standard way is:
SELECT Int(MyFloatField)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top