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

Export query to Excel with outputTo function

Status
Not open for further replies.
Mar 13, 2004
2
Dear all,

I'm using the function "outputTo" to export data from Access to Excel.

My code:
DoCmd.OutputTo acOutputQuery, "Query", acFormatXLS, CurrentProject.Path & "\Query " & strDate & ".xls"
DoCmd.Close acQuery, "Query", acSaveNo

I want to use the Access application on 2 computers. The code is only working on one of them. The second computer generates an Excel file but in stead of showing the correct data it shows the error message "#Name?" in the first three fields.

Office 2000 is installed on both computers. I've checked the options and references. The only difference I could found was the reference "Microsoft ActiveX Data Objects Recordset 2.8 Library". On computer 1: version 2.8, on computer 2: version 2.6

Can somebody give me some advice?
Thanks in advance!

Best regards,
Koen
 
Is this method working ?
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Query", CurrentProject.Path & "\Query " & strDate & ".xls", True

I would suggest to rename the query to something more descriptive.

 
also check that in the 2nd computer your actually exporting the correct data.

it could be one of your DSN's not working properly...

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top