Unanswered: How to Output SQL Server SP result to xls file?
In a project I'm working on I need to import a result of SQL Server Stored Procedure (a simple Select-Union sql-statement) to xls file.
In code (below) I'm establishing connection to SQL Server and than trying to have sp_ActiveAccounts Stored Procedure outputting in xls file. The window "Output To" pops up. When I click OK I got an error message: "The MS Jet Engine cannot find the object sp_ActiveAccounts". I understand that DoCmd.OutputTo looks for Access database Tables/Queries, and that Jet Engine is active. How can I make it looking for Server's sp_ActiveAccounts Stored Procedure? What part of code have i omitted?
dim Cnxn As ADODB.Connection
Set Cnxn = New ADODB.Connection