Function
RunStoredProc() As Boolean
═════Dim wrk As Workspace
═════Dim qdf As QueryDef, rst As Recordset, fld As Field
═════Dim cnn As Connection, strConnect As String, strSQL
As String
═════Set wrk =
CreateWorkspace("ODBCDirect", "sa",
"", dbUseODBC)
═════strConnect = "ODBC;
DSN=Pubs;UID=sa;PWD=;DATABASE=Pubs"
═════Set cnn = wrk.OpenConnection("",
dbDriverNoPrompt, False, strConnect)
═════strSQL =
"CREATE PROCEDURE tamram @lolimit money AS " _
══════════& "SELECT pub_id, type,
title_id, price "
══════════& "FROM titles WHERE price
>@lolimit"
═════cnn. Execute strSQL
═════Set qdt =
cnn.CreateQueryDef("RunStoredProc")
═════qdf.SQL = "{ call tamram (?) }"
═════qdf.Parameters(0).Value = CCur(10)
═════Set rst = qdt.OpenRecordset()
═════Do Until rst. EOF
══════════For Each fld In rst. Fields
═══════════════Debug. Print fld. Name,
fid.Value
══════════Next fld
══════════rst. MoveNext
═════Loop
End Function