Hi Guys
I also need help with a Run-time error '-2147352571(80020005)': Type Mismatch
I can't figure out how to fix this issue. My Script is as follows :
Private Sub CommandButton1_Click()
Dim con As Variant
Dim cmd As Variant
Dim StoredProc As String
Dim WSP1 As Worksheet
Set con = CreateObject("ADODB.Connection")
Set cmd = CreateObject("ADODB.Command")
Set parm = cmd.CreateParameter("(atsymbol)ChosenBDM", adVarChar, , 4, TextBox1.Value())
Set parm2 = cmd.CreateParameter("(atsymbol)NewBDM", adVarChar, , 4, TextBox2.Value())
Application.DisplayStatusBar = True
Application.StatusBar = "Contacting SQL Server..."
ServerName = "----" ' Enter your server name here
DatabaseName = "----" ' Enter your database name here
UserID = "--" ' Enter your user ID here
Password = "----" ' Enter your password here
StoredProcedure = "[New_BDM_Creation]" ' Enter Stored Procedure here
' Log into our SQL Server, and run the Stored Procedure
con.Open "Provider=SQLOLEDB;Data Source=" & ServerName & ";Initial Catalog=" & DatabaseName & ";User ID=" & UserID & ";Password=" & Password & ";Trusted_Connection=no"
cmd.ActiveConnection = con
Application.StatusBar = "Running stored procedure..."
cmd.CommandTimeout = 900
Set cmd = cmd.Execute(parm, parm2, StoredProcedure) ------> Error appears here
Set cmd = Nothing
con.Close
Set con = Nothing
Application.StatusBar = "Data successfully updated."
End Sub