OutPutTo Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using Access 2003 for my database and have code written to export data
into excel, the following code works in my program:

Private Sub ExportBtn_Click()
On Error GoTo ExportBtn_Click_Err
Call RetrieveBtn_Click

DoCmd.OutputTo acQuery, "qryQuickQueryCrosstab",
"MicrosoftExcelBiff8(*.xls)", "", True, "", 0

However when I try to run the database on a computer with a older version of
access the data will not export. Is there something wrong with the code or
are the older versions just not compatible?
 
Why don't you use

docmd.TransferSpreadsheet acExport ,acSpreadsheetTypeExcel5
,"YourQueryName","YourFilename",true

you can also change acSpreadsheetTypeExcel5 in other versions of excel but i
recommend this one for general compatibility

- Raoul
 
Back
Top