Hello. I have found some discussions on this site about how to execute a stored procedure. I have followed the examples and even had a DBA run a trace while I executed the SP. The follwoing code runs fine until after I issue the .Execute method and assign it to an ADODB.Recordset object; the recordset seems to be closed. My DBA verified that I am getting data returned and if I run the SP in a Passthrough Query, I get data. Can anyone help point me in the right direction or point out what I am doing wrong? This is in an Access 2010 database.
Thanks,
Code:
Dim adoConnection As New ADODB.Connection
Dim adoCommand As ADODB.Command
Dim WorkstationsRST As ADODB.Recordset
adoConnection.ConnectionString = "Provider=SQLOLEDB;Data Source=SERVERNAME;Database=DBNAME;Trusted_Connection=Yes;Integrated Secuirty=SSPI"
adoConnection.ConnectionTimeout = 10
adoConnection.Open
Set adoCommand = New ADODB.Command
adoCommand.ActiveConnection = adoConnection
adoCommand.CommandType = adCmdStoredProc
adoCommand.CommandText = "usp_get_wrkstn_info"
adoCommand.Parameters.Refresh
'adoCommand.Parameters("@RACF_ID").value = "ALL"
adoCommand("@RACF_ID") = "ALL"
Set WorkstationsRST = adoCommand.Execute()
Me.lstAssignedWorkstations.Recordset = WorkstationsRST
Me.lstAssignedWorkstations.Requery
Thanks,