Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type Mismatch

Status
Not open for further replies.

ohmbru2

Technical User
Jul 24, 2001
51
US
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
 
Here's a wild guess:
param1.Value = strCo

Hope this helps...

Tom


Live once die twice; live twice die once.
 
Your argument strCo, does it need to be a variant?
 
I figured it out:

Dim param1 As adodb.Parameter, param2 As adodb.Parameter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top