DoCmd.TransferSpreadsheet - Access can't find my query

  • Thread starter bifteki via AccessMonster.com
  • Start date
B

bifteki via AccessMonster.com

I have the following line in my code:

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"sp_export_persons_to_excel", "W:\DOCS\DRAFTS\eortazontes.xls", True, "A1:
G12"

sp_export_persons_to_excel is a stored procedure.
However Access tells me that it "can't find the object
'sp_export_persons_to_excel' ".
I tried replacing the string "sp_export_persons_to_excel" with the names of
other queries in my DB, but I get the same message.

Does anyone know why this may occur?
 
K

Klatuu

When you say stored procedure, I am thinking SQL Server. There are no
stored procedures in Access.
The TransferSpreadsheet will not find an objects in SQL Server, it has to be
an Access Query in your database.
 
B

bifteki via AccessMonster.com

Hmm... Maybe I'm getting something wrong.
In Access (at least 2003 & 2007 which I'm using) you have the option to
create either a view, stored procedure, or function.
I made this stored procedure in access. I also tried creating it as a view
but Access still can't find the object.

When you say stored procedure, I am thinking SQL Server. There are no
stored procedures in Access.
The TransferSpreadsheet will not find an objects in SQL Server, it has to be
an Access Query in your database.
I have the following line in my code:
[quoted text clipped - 10 lines]
Does anyone know why this may occur?
 
K

Klatuu

If you are using an ADP connected to an SQL Server back end, you can, but
you did not state that.

bifteki via AccessMonster.com said:
Hmm... Maybe I'm getting something wrong.
In Access (at least 2003 & 2007 which I'm using) you have the option to
create either a view, stored procedure, or function.
I made this stored procedure in access. I also tried creating it as a view
but Access still can't find the object.

When you say stored procedure, I am thinking SQL Server. There are no
stored procedures in Access.
The TransferSpreadsheet will not find an objects in SQL Server, it has to
be
an Access Query in your database.
I have the following line in my code:
[quoted text clipped - 10 lines]
Does anyone know why this may occur?
 
B

bifteki via AccessMonster.com

I guess you are right. I didn't think of that.
The DB is indeed on SQL server.
So this means I cannot use TransferSpreadsheet at all?

If you are using an ADP connected to an SQL Server back end, you can, but
you did not state that.
Hmm... Maybe I'm getting something wrong.
In Access (at least 2003 & 2007 which I'm using) you have the option to
[quoted text clipped - 13 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top