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

Exporting Access Data into Excel - Formatting Issues

Status
Not open for further replies.

dbuuch

IS-IT--Management
Dec 15, 2003
17
US
I have used both the DoCmd.OutputTo and the DoCmd.TransferSpreadsheet methods to export data from an Access DB into Excel.

the following is an example of the code:

Code:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, sQueryName, strPath

The problem i have is that, in Excel, all cell contents of the exported data are prefixed with a single open quote mark. this makes numbers and Dates appear as Text and so do not allow for any mathematical operations to be done with the number.

Is there anything i can do to correct this?
 
Make sure your fields aren't defined as text in the field definitions of the table(s) you are pulling the data from. TransferSpreadsheet will bring in numbers and dates correctly if they are defined as those datatypes in the Access tables.

--Brad
 
Thanks Brad but this doesn't solve the problem. There are other text field that are also prefixed with the single quotes, besides the number and date fields.

when the data is imported using the "import External Data" functionality in Excel, however, there are no single quotes and the data look perfect.

i would still like to use vba to export the data though but would like to get rid of this single quote prefixes.

daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top