[dba-SQLServer]Exporting SPROC with Parameters to Excel

David Emerson davide at dalyn.co.nz
Thu Apr 3 18:53:51 CST 2003


Good thinking.  We are getting closer.

Now I have -

strSprocName = "EXEC spBookingExport @txtMDQSeasonAdj=0, @txtMDQDivider=20"
DoCmd.OutputTo acOutputStoredProcedure, strSprocName, acFormatXLS, strFullName

An error 119 appears saying that I must pass parameter number 2 and 
subsequest parameters as "name = value".

If I just have one parameter thus -

strSprocName = "EXEC spBookingExport @txtMDQSeasonAdj=0"
DoCmd.OutputTo acOutputStoredProcedure, strSprocName, acFormatXLS, strFullName

it works ok.  My pick is that the DoCmd is taking the comma in the EXEC 
statement as the comma for its own parameters.  Putting a single quote 
around the whole EXEC call doesn't work either (invalid object name).

At 3/04/2003, you wrote:
>I don't use that feature, but perhaps this might help, I've found that the
>"EXEC stpMystoredProcedure @Param1 = " & iMyparam1 & ", @Param2 = '" &
>strParam2 & "'" works well when applying it to listboxes, combo, forms.. you
>name it ... I wonder if it would work this way for you as well...
>
>
>-Francisco
>http://rcm.netfirms.com
>
>On Thursday, April 03, 2003 4:15 PM [GMT-8],
>David Emerson <davide at dalyn.co.nz> wrote:
>
>: I am able to use the following line to export the result of a sproc
>: to excel -
>:
>:      DoCmd.OutputTo acOutputStoredProcedure, "spBookingExport",
>: acFormatXLS, strFullName
>:
>: However, can I do it if the sproc has parameters and I don't want the
>: user
>: to have to enter in the values as they are already on the form that
>: calls
>: the sproc?
>:
>: Regards
>:
>: David Emerson
>: DALYN Software Ltd
>: 25b Cunliffe St, Johnsonville
>: Wellington, New Zealand
>: Ph/Fax (877) 456-1205
>:
>: _______________________________________________
>: dba-SQLServer mailing list
>: dba-SQLServer at databaseadvisors.com
>: http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>: http://www.databaseadvisors.com
>
>
>_______________________________________________
>dba-SQLServer mailing list
>dba-SQLServer at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>http://www.databaseadvisors.com

Regards

David Emerson
DALYN Software Ltd
25b Cunliffe St, Johnsonville
Wellington, New Zealand
Ph/Fax (877) 456-1205 



More information about the dba-SQLServer mailing list