TransferSpreadsheet Problems

  • Thread starter Thread starter RudiK
  • Start date Start date
R

RudiK

I am trying to export records based on a query.

DoCmd.TransferSpreadsheet
acExport, , "Query", "C:\test.xls", True

The Query "query" works fine but it does not seem to be
accepted by the "TransferSpreadsheet"-method. I get an
error 7874 which says that the object "query" can not be
found ? Am i doing someting wrong ???
 
What is the name of your query? According to the command, it is looking for
a query named "Query". Put the actual name of the query in this position.

If it IS named "Query", perhaps there is a naming conflict since "query" is
an Access reserved word. Name it something else.
 
OK, My query has a different name. I was not planning to
let the whole world see what kind of data i am using. Lets
say the query is named "qryTest". Can you help me in any
way...

Thanks
 
In that case, it should be:
DoCmd.TransferSpreadsheet acExport, , "qryTest", "C:\test.xls", True

If you want to specify a specific version of Excel, do this:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "qryTest",
"C:\test.xls", True
 
OK, i got this far but what to do if access says that in
cannot find "qryTest" ? See my first post.....
-----Original Message-----
In that case, it should be:
DoCmd.TransferSpreadsheet
acExport, , "qryTest", "C:\test.xls", True
If you want to specify a specific version of Excel, do this:
DoCmd.TransferSpreadsheet acExport,
acSpreadsheetTypeExcel8, "qryTest",
 
Unfortunately, I don't know. That is the correct syntax for the
TransferSpreadsheet method. It should work if you have spelled the name of
the query correctly. One slight possibility is that it might be getting
confused if you have a table and query named exactly the same. Check for
that.

Otherwise, I'm stumped. You might need to create a new database, import ALL
of the objects from the old into the new, and see if it works there. There
might be some corruption in your old database.
 
Hello,

Are you exporting a select query? You can only export Tables or Select
Queries using the TransferSpreadsheet action.
You can also try DoCmd.OutputTo method.

Hope this helps!

Ki
 
Back
Top