Running a stored procedure in a macro


Posted by Damien on January 30, 2002 12:58 PM

I need help with running a stored procedure on a SQL database thru a macro. Micrsoft knowledge base is very brief on the subject I just need an example so I can copy or modify it, Thanks.



Posted by Damien on January 31, 2002 12:54 PM


I'm trying to use this:

databaseName = "DMSTest_Local"
queryString = _
"exec Upload_Dealer_Fees_Securities"
chan = Sql.Open("DSN=" & databaseName)
Sql.Exec.Query chan, queryString
Set output = Worksheets("Deductions Securities").Range("A6")
Sql.Retrieve chan, output, , , True
Sql.Close chan