How To Pull Access Query into Excel (2003): Reposting

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

Guest

Hello: i previously posted code that successfully pulls an Access 2003 table
into an Excel 2003 spreadsheet. How is this done pulling a query, using a
query name? (Not using a SQL string that defines the query.)

Thanks~
 
Bettergains said:
Hello: i previously posted code that successfully pulls an Access 2003 table
into an Excel 2003 spreadsheet. How is this done pulling a query, using a
query name? (Not using a SQL string that defines the query.)

If it is a VIEW type query

SELECT MyCol1, MyCol2 FROM MyQuery;

If it a PROCEDURE type query:

EXECUTE MyQuery arg1, arg2
or
{CALL MyQuery arg1, arg2}

Jamie.

--
 
Hi Bettergains

A couple more suggestions if your using ADO. you didn't really give much
information.

I use the following:

' When using a connection object

cnn.Open
Set Rs = cnn.Execute("Your Query Name", , adCmdStoredProc)

' When using a Command object

cnn.Open
CMD.ActiveConnection = cnn
CMD.CommandText = "[Your Query Name]"
CMD.CommandType = adCmdUnknown
Set Rs = CMD.Execute

Good Luck
TK
 

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

Similar Threads


Back
Top