Hi All,
How can I get a SQL Server stored procedure output into an Access query so that I can Open the query and view the entire record(s) results?
Here is the VBA that successfully runs the stored procedure. I can view the output in the intermediate window using:
?rs.Fields("Trust").value = -725.6
This is what I want to see (whole record):
Loan Number Trust Branch Processing Fee MIP ..........etc
5660488444 -725.60 -1150.00 -1550.25
Here is the code that I have so far.
'*********************************
Public Sub Run_HUD_Indvidual()
'*********************************
Dim cmdObj As New ADODB.Command
Dim rs As New ADODB.Recordset
Dim strLoanNo As String
Dim SQL As String
strLoanNo = "5660488444"
cn_Dev.CommandTimeout = 15
cn_Dev.Mode = adModeReadWrite
Open_DEV ' Opens a Connection
With cmdObj
.ActiveConnection = cn_Dev
.CommandType = adCmdStoredProc
.CommandTimeout = 120
.CommandText = "dbo.SUMMIT_AMB_HUD_Import_Revision_1_AutoImport_N etFunding_Individual_RWC"
.Parameters.Append .CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue) ' Return should be first
.Parameters.Append .CreateParameter("sLoanNumber", adVarChar, adParamInput, 50, strLoanNo)
End With
rs.CursorType = adOpenKeyset
rs.LockType = adLockBatchOptimistic
'Set rs = cmdObj.Execute
rs.Open cmdObj
'WORKS
'? rs.Fields("MIP").Value
'-725.6
rs.Close
Set rs = Nothing
Set cmdObj = Nothing
cn_Dev.Close
Set cn_Dev = Nothing
End Sub