Transferspreadsheet problem

min3010

Registered User.
Local time
Today, 16:44
Joined
Oct 14, 2007
Messages
10
Hi,

I am attempting to write a VBA function that transfers data from a query in access to an excel spreadsheet. The code is as follows:

Code:
'Export data to excel
Public Function dataExport()

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "dataroaming", "C:\Reece.xls", True
MsgBox "Export Complete!"
DoCmd.Close

End Function

I get an error that complains that the object "dataroaming" does not exist. However the query definately exists.

Does anybody have an idea of what the problem may be?

Thankyou!
 
without checking i think dataroaming should be the name of a table in your database (can be and probably is more likely a query)

what is dataroaming in your system
 
Dataroaming is a query not a table. Is the code expecting Dataroaming to be a table? I was under the impression that in the syntax you can specify a query or table.
 
You have the right syntax. Maybe it doesn't like your name?

Change the query to qryDataRoaming

Who knows sometimes about the name things. :confused:
 

Users who are viewing this thread

Back
Top Bottom