Like mentioned in the title, I just want to call a SQL Server stored procedure from VBA.
I can call my stored procedure like this:
EXEC dbo.spClientXLS @Nr = ' 131783', @date = '21.09.2014'
Nr
is a varChar(50)
type value, and date
is of type date
Now, if I want to call it from VBA, I get an error message. My code in VBA is:
...'SQL Server stored procedure which is to execute with parameters
Dim ADODBCmd As New ADODB.Command
With ADODBCmd
.ActiveConnection = objconn
.CommandTimeout = 500
.CommandText = "dbo.spClient"
.CommandType = adCmdStoredProc
End With
Set recordset = ADODBCmd.Execute(, date, Nr)
Date
is of type Date
, Nr
is of type String
.
I would be happy, if somebody can explain me, how I can handle it with two arguments.
Regards