Reputation: 63
I am trying to run the following Stored Procedure on the click of the OK Button:
Private Sub ok_Click()
Dim objConnection As New ADODB.Connection
Dim objCom As ADODB.Command
Dim provStr As String
Set objCom = New ADODB.Command
objConnection.Provider = "sqloledb"
provStr = "Data Source=Server Name;" & "Initial Catalog=DB NAME;User Id=USERNAME;Password=Password;"
objConnection.Open provStr
With objCom
.ActiveConnection = objConnection
.CommandText = "dbo.ix_spc_planogram_match 74"
.CommandType = adCmdStoredProc
.Execute
End With
End Sub
The error is:User type not defined. The stored procedure runs correctly in SQL Server Management Studio.
Upvotes: 1
Views: 336
Reputation: 91376
Check your references, in particular ensure you are referencing the Microsoft ActiveX Data Objects x.x Library.
Upvotes: 1