When i execute the following as a pass-through query it works
However i cant get this to execute in vba
What am i missing from my VBA code? The store proc is an update statement and I know that it works.
How would i know if my connection string is the problem?
Code:
exec dbo.sp_MyStoredProc @Parameter1 = 1, @Parameter2 = 3
However i cant get this to execute in vba
Code:
Dim recordsAffected As Long
Set conn = New ADODB.Connection
conn.ConnectionString = "MyConnectionString"
Set cmd = New ADODB.Command
cmd.ActiveConnection = conn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "dbo.sp_MyStoredProc"
cmd.Parameters.refresh
cmd(1) = 1
cmd(2) = 3
cmd.Execute recordsAffected
What am i missing from my VBA code? The store proc is an update statement and I know that it works.
How would i know if my connection string is the problem?