Hi all,
Normally I would consider putting this directly under the MS SQL category, but I'm pretty certain the problem I'm having lies with VBA/Access.
I am attempting to pass values from from as parameters to a stored procedure using the following:
Private Sub Command8_Click()
Dim SPCommand As ADODB.Command
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Set SPCommand = New ADODB.Command
SPCommand.CommandText = "spMarkAsInvoiced"
SPCommand.CommandType = adCmdStoredProc
SPCommand.CommandTimeout = 300
SPCommand.ActiveConnection
= CurrentDb.Connection
SPCommand.Parameters("@Inv
Num").Valu
e = Me.Text6
SPCommand.Parameters("@CID
").Value = Me.ClientID
SPCommand.Parameters("@Sta
rtDate").V
alue = Me.StartDateForForm
SPCommand.Parameters("@Sto
pDate").Va
lue = Me.StopDateForForm
SPCommand.Execute
End Sub
However, when I attempt execution, I get "Run-time error '91': Object variable or With block variable not set" and after clicking "Debug" it highlights this line: SPCommand.ActiveConnection
= CurrentDb.Connection from above.
Any thoughts on what I am doing wrong, or is there a better approach to execute this stored procedure while passing parameters that I'm unaware of?
Thanks!
Start Free Trial