export to excel as a number field

J

JIM. H.

Hello,
I am using the following command to export a table to an
excel file. DoCmd.TransferSpreadsheet acExport,
8, "QuerySelect", fileNamePath, False, ""
QuerySelect is a select query I defined in Access.
There is one field which is a text type in the database
and I need to export that field as a number field into
excel (the field contains a float number with decimal
points)
How can I do that?
Thanks,
Jim.
 
A

Allen Browne

In the query, use Val() around the text field to convert to number.
Val() cannot handle nulls, so you may need Nz() as well.

Example of the calculated query field:
MyNum: Val(Nz([MyText], 0))
 

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