I am using Access 2000 and SQL 2000. I want to use a stored procedure (with 2 paramters) as the source for exporting to a spreadsheet.
This is similar to a post by GShen thread: 707-496426.
GShen found the answer to this, but I cannot get the code to work.
It works fine if I use:
lSQLExStr = "spMyProc"
DoCmd.OutputTo acOutputStoredProcedure, lSQLExStr, acFormatXLS, MyFileName & ".XLS"
But, it prompts for the 2 parms, as it should.
I have tried:
lSQLExStr = "spMyProc '" & lData1 & "', '" & lData2 & "'"
DoCmd.OutputTo acOutputStoredProcedure, lSQLExStr, acFormatXLS, MyFileName & ".XLS"
and also:
lSQLExStr = "spMyProc @parm1 = '" & lData1 & "', @parm2 = '" & lData2 & "'"
DoCmd.OutputTo acOutputStoredProcedure, lSQLExStr, acFormatXLS, MyFileName & ".XLS"
Get Runtime error '2757'
"There was a problem accessing a property or method of the OLE object."
Thanks in advance for any help!
vbprgmr
This is similar to a post by GShen thread: 707-496426.
GShen found the answer to this, but I cannot get the code to work.
It works fine if I use:
lSQLExStr = "spMyProc"
DoCmd.OutputTo acOutputStoredProcedure, lSQLExStr, acFormatXLS, MyFileName & ".XLS"
But, it prompts for the 2 parms, as it should.
I have tried:
lSQLExStr = "spMyProc '" & lData1 & "', '" & lData2 & "'"
DoCmd.OutputTo acOutputStoredProcedure, lSQLExStr, acFormatXLS, MyFileName & ".XLS"
and also:
lSQLExStr = "spMyProc @parm1 = '" & lData1 & "', @parm2 = '" & lData2 & "'"
DoCmd.OutputTo acOutputStoredProcedure, lSQLExStr, acFormatXLS, MyFileName & ".XLS"
Get Runtime error '2757'
"There was a problem accessing a property or method of the OLE object."
Thanks in advance for any help!
vbprgmr