运行存储过程:用户类型未定义错误

时间:2012-07-10 19:04:10

标签: sql-server ms-access vba access-vba

我试图在单击OK按钮时运行以下存储过程:

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

错误是:未定义用户类型。存储过程在SQL Server Management Studio中正确运行。

1 个答案:

答案 0 :(得分:1)

检查您的引用,特别是确保引用Microsoft ActiveX Data Objects x.x库。