I seem to be having difficulty getting a return value from my SP into VBA.
I have issued a RETURN in my T-SQL which is fine, but I can't seem to work out how to get the value in the VBA?
Dim qd As QueryDef
Dim db As DAO.Database
Dim vRate As Integer
vRate = 3
Set db = CurrentDb
Set qd = db.QueryDefs("spCC_UpdateRAG")
' inital rating
qd.SQL = "EXEC spCC_UpdateRAG @Col = 'Rating', @RAG = " & Nz(vRate, "NULL") & ", @Case_ID = 36"
qd.Execute
This works fine other than I can't seem to get the return value?
So I thought I would try with OUPUT params instead, but SQL moans if you don't assign them a value, which makes no sense as they are output not input params?
So I tried this in my T-SQL...
-- return failure (false)
SET @Result = 0
SELECT @Result
but that gives me a result set return which I don't want and a column with no name, so if I have to do this..
-- return failure (false)
SET @Result = 0
SELECT @Result AS Result
What's the point? I might as well do...
SELECT 0 AS Result
And either way I'm getting back a recordset and I don't want one, I just want to return a bit (true/false)
Was the SP successful or not, how do I do this and get the value in my VBA code?
Your input is appreciated. 1DMF
adParamReturnValuewas used in theCreateParametermethod of theADODB.Commandobject in this SO answer.