Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Smile Unanswered: Export a fraction

    I have a field has the value 0.1322, when I export it using the DoCmd.TransferText acExportDelim, it goes as 0.13 I used the format but in vain, how could I get it as its original value and not rounded?
    Thanks

  2. #2
    Join Date
    Sep 2003
    Location
    Caldes de Malavella, Spain
    Posts
    244

    Re: Export a fraction

    At what point exactly are you converting the number into a string? Have you tried using the Str() function to convert the number into a string before attempting the export? That will tell you exactly when it's going wrong. Hang on, I'll just test that for you...yes, you're right, the number field loses its decimals. However, I used Str() in a query to convert the number to a string, and that has retained its decimals after export. You lose the leading zero though.


    Hope this helps.


    Originally posted by hammbakka
    I have a field has the value 0.1322, when I export it using the DoCmd.TransferText acExportDelim, it goes as 0.13 I used the format but in vain, how could I get it as its original value and not rounded?
    Thanks
    Andy Briggs
    Elmhurst Solutions Limited
    Database Development and Consultancy
    http://www.elmhurstsolutions.com

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Re: Export a fraction

    Originally posted by andybriggs
    At what point exactly are you converting the number into a string? Have you tried using the Str() function to convert the number into a string before attempting the export? That will tell you exactly when it's going wrong. Hang on, I'll just test that for you...yes, you're right, the number field loses its decimals. However, I used Str() in a query to convert the number to a string, and that has retained its decimals after export. You lose the leading zero though.


    Hope this helps.
    Thank you 4 your reply
    I tried the str() function but it converts it to strings which is not desired by another program, that exports it again.

    I made a query that formats the desired fields from the original table, then I used this query in the Export statement DoCmd.TransferText acExportDelim, , TableName, fileName

    I need it as single and not as string

  4. #4
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    Presuming that you don't want to use OutputTo (which will retain your decimals), if you change your data type to Decimal, Fixed, Precision (to whatever you actually need), and decimal places 4, you will get .1322 with DoCmd.TransferText.

    HTH.
    All code ADO/ADOX unless otherwise specified.
    Mike.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •