Bind Access form to the results from a Stored Procedure

后端 未结 3 1881
失恋的感觉
失恋的感觉 2021-01-05 15:32

I am trying to return the results of a stored procedure to a form. I have managed to iterate thru the results using an ADO recordset, but cannot bind the results to the form

3条回答
  •  醉酒成梦
    2021-01-05 15:49

    You need to use Set whenever you assign an object reference in VBA.

    Change Me.Recordset = .Execute to Set Me.Recordset = .Execute.

    Also, you probably need to open it with a supported cursor type. I don't think there's a way to change the cursor type if you use the Execute method on the Command object. You'll have to create the Recordset separately.

    Set rs = New ADODB.Recordset
    rs.Open cmd, , adOpenKeyset
    Set Me.Recordset = rs
    

提交回复
热议问题