1
因爲在主題中,我需要將存儲過程結果連接爲記錄集。用一些例子,我發現我想出了:MS-Access 2013將存儲過程結果連接到組合框記錄集
Dim cn As New ADODB.Connection
cn = GetConnection()
Dim cmd As New ADODB.Command
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
With cmd
.ActiveConnection = GetConnection()
.CommandText = "dbo.K_Kod_Agenta_P"
.CommandType = adCmdStoredProc
.Parameters.Refresh
End With
With rs
.ActiveConnection = GetConnection()
.CursorType = adOpenForwardOnly
.CursorLocation = adUseServer
End With
Set rs = cmd.Execute
Set Me.kod_nadagenta.Recordset = rs
rs.Close
cn.Close
但是,當它擊中
Set Me.kod_nadagenta.Recordset = rs
它拋出
「運行時錯誤‘7965’:您輸入的對象不是有效的Recordset屬性「。