I have an Access 2003 database that connects to a SQL Server 2008 mailbox through ODBC. Tables from SQL Server are connected as linked tables in Access. I have a stored procedure on SQL Server that I am trying to execute using ADO code. The problem is that Access cannot find the procedure. What do I need to do in Access to execute this stored procedure? Some facts ...
The stored procedure in question takes one parameter, which is an integer. The stored procedure returns a record set, which I hope to use as a data source for the ListBox.
Here is my ADO code in Access ...
Private Sub LoadUserCaseList(userID As Integer)
Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "uspGetUserCaseSummaryList"
Dim par As New ADODB.Parameter
Set par = cmd.CreateParameter("userID", adInteger)
cmd.Parameters.Append par
cmd.Parameters("userID") = userID
Dim rs As ADODB.Recordset
Set rs = cmd.Execute()
lstUserCases.Recordset = rs
End Sub
, , , " Microsoft Jet Jet " uspGetUserCaseSummaryList ".