This codes fails on the line that sets param1 with a run time error 13, Type Mismatch.
Can anyone help me out?
Dim strYear As String
Dim strCo As String
Dim param1 As Parameter, param2 As Parameter
strYear = DMax("param.strYear", "param")
strCo = DMax("param.strCo", "param")
Dim adoCnn As ADODB.Connection
Dim adoCmd As ADODB.Command
Set adoCnn = New ADODB.Connection
Set adoCmd = New ADODB.Command
adoCnn.ConnectionString = "Driver={SQL Server};" & _
"Server=tamlrpcdbs1;" & _
"Database=glgnt;" & _
"Trusted_Connection=Yes"
adoCmd.CommandText = "PTR_sp"
adoCmd.CommandType = adCmdStoredProc
Set param1 = adoCmd.CreateParameter(, adVarChar, adParamInput, 50, strCo)
adoCmd.Parameters.Append param1
param1.Value = strCo
Set param2 = adoCmd.CreateParameter(, adVarChar, adParamInput, strYear)
adoCmd.Parameters.Append param2
param2.Value = strYear
adoCmd.Execute
Can anyone help me out?
Dim strYear As String
Dim strCo As String
Dim param1 As Parameter, param2 As Parameter
strYear = DMax("param.strYear", "param")
strCo = DMax("param.strCo", "param")
Dim adoCnn As ADODB.Connection
Dim adoCmd As ADODB.Command
Set adoCnn = New ADODB.Connection
Set adoCmd = New ADODB.Command
adoCnn.ConnectionString = "Driver={SQL Server};" & _
"Server=tamlrpcdbs1;" & _
"Database=glgnt;" & _
"Trusted_Connection=Yes"
adoCmd.CommandText = "PTR_sp"
adoCmd.CommandType = adCmdStoredProc
Set param1 = adoCmd.CreateParameter(, adVarChar, adParamInput, 50, strCo)
adoCmd.Parameters.Append param1
param1.Value = strCo
Set param2 = adoCmd.CreateParameter(, adVarChar, adParamInput, strYear)
adoCmd.Parameters.Append param2
param2.Value = strYear
adoCmd.Execute