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属性“。