I need help executing a stored procedure from an Access form.
The stored procedure is already declared in the SQL Server as:
There is a button on my form called 'delete_Log' and the code behind it is:
I stops on the line: objcmd(1) = sel_Log.Value and says "Item cannot be found in the collection corresponding to the requested name or ordinal."
What am I doing wrong?
Thanks.
The stored procedure is already declared in the SQL Server as:
Code:
CREATE PROCEDURE [spSK_Delete]
@recToDelete int
AS
delete from [logs]
where logid = @recToDelete
GO
There is a button on my form called 'delete_Log' and the code behind it is:
Code:
Dim cn As New ADODB.Connection
Dim objcmd As New ADODB.Command
With cn
.Provider = "msdasql"
.Properties("data source").Value = "ODBC;DSN=myCompany;UID=sa;PWD=;DATABASE=LogInventory"
.Open
End With
objcmd.CommandText = "sp_SKDelete"
objcmd.CommandType = adCmdStoredProc
objcmd.ActiveConnection = cn
objcmd(1) = sel_Log.Value
objcmd.Execute
cn.Close
Set cn = Nothing
Set objcmd = Nothing
I stops on the line: objcmd(1) = sel_Log.Value and says "Item cannot be found in the collection corresponding to the requested name or ordinal."
What am I doing wrong?
Thanks.