Exporting Double without Decimals

F

FBxiii

Hi.

I am trying to export a table to a text file using VBA (TransferText). The
file exports fine but the Double values in it have decimal places.

How do I export the table but without the decimals? The values are real
'doubles' as they are too big to be Long Integers. I need the text fields to
have the quote marks but the numerics to not.

I've tried Fix and Int in a query but these did not work either!

Thanks for any advice,
Steve.
 
J

Jerry Whittle

You were on the right track. First use the Fix or Int functions to strip off
the decimals. The wrap that with the CStr() function to convert the number to
text.

Jerry
 
C

Clifford Bass

Hi,

You could format the decimal field and explicitly put quotes around the
text fields, then export with no text qualifier.

SELECT Format([DOUBLE_FIELD],"0") AS DOUBLE_FIELD_NO_DECIMAL, """" &
[TEXT_FIELD] & """" AS TEXT_FIELD_QUOTED
FROM tblData;

Clifford Bass
 
F

FBxiii

Thanks for the reply Jerry but I need the number to remain in the number
format once exported.

Cheers,
Steve.
 

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