Hello Everyone,
Could someone please look at my code and tell me why the first parameter is receiving the error: Parameter object is improperly design #3708?
Private Sub Stored_Procedure(Value As String)
Dim EMEDcnn As ADODB.Connection
Dim cmdEMED As ADODB.Command
Dim prmEMEDinput As ADODB.Parameter
Dim prmEMEDoutput1 As ADODB.Parameter
Dim prmEMEDoutput2 As ADODB.Parameter
Dim prmEMEDoutput3 As ADODB.Parameter
Dim strCnn As String
Dim x As Integer
Dim prmVal As Integer
' Open connection.
Set EMEDcnn = New ADODB.Connection
strCnn = "Provider = Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=T:\Emedxlate.mdb"
EMEDcnn.Open strCnn
EMEDcnn.CursorLocation = adUseClient
' Open command object with one parameter.
Set cmdEMED = New ADODB.Command
cmdEMED.CommandType = adCmdStoredProc
cmdEMED.CommandText = "SQL_Name"
' Get parameter value and append parameter.
Set prmEMEDinput = cmdEMED.CreateParameter("QryName", adVarChar, adParamInput, , Value)
Set prmEMEDoutput1 = cmdEMED.CreateParameter("RtnName", adVarChar, adParamOutput, 255)
Set prmEMEDoutput2 = cmdEMED.CreateParameter("RtnNum", adInteger, adParamOutput, 25)
Set prmEMEDoutput3 = cmdEMED.CreateParameter("RtnDept", adVarChar, adParamOutput, 255)
cmdEMED.Parameters.Append prmEMEDinput
cmdEMED.Parameters.Append prmEMEDoutput1
cmdEMED.Parameters.Append prmEMEDoutput2
cmdEMED.Parameters.Append prmEMEDoutput3
' Create recordset by executing the command.
Set cmdEMED.ActiveConnection = EMEDcnn
cmdEMED.Execute
'Get Parameter values
With FrmDocTbl
For x = 0 To 2
prmVal = (x + 1)
.LblDoc(x).Caption = cmdEMED.Parameters(prmVal).Value
Next x
End With
EMEDcnn.Close
End Sub
Could someone please look at my code and tell me why the first parameter is receiving the error: Parameter object is improperly design #3708?
Private Sub Stored_Procedure(Value As String)
Dim EMEDcnn As ADODB.Connection
Dim cmdEMED As ADODB.Command
Dim prmEMEDinput As ADODB.Parameter
Dim prmEMEDoutput1 As ADODB.Parameter
Dim prmEMEDoutput2 As ADODB.Parameter
Dim prmEMEDoutput3 As ADODB.Parameter
Dim strCnn As String
Dim x As Integer
Dim prmVal As Integer
' Open connection.
Set EMEDcnn = New ADODB.Connection
strCnn = "Provider = Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=T:\Emedxlate.mdb"
EMEDcnn.Open strCnn
EMEDcnn.CursorLocation = adUseClient
' Open command object with one parameter.
Set cmdEMED = New ADODB.Command
cmdEMED.CommandType = adCmdStoredProc
cmdEMED.CommandText = "SQL_Name"
' Get parameter value and append parameter.
Set prmEMEDinput = cmdEMED.CreateParameter("QryName", adVarChar, adParamInput, , Value)
Set prmEMEDoutput1 = cmdEMED.CreateParameter("RtnName", adVarChar, adParamOutput, 255)
Set prmEMEDoutput2 = cmdEMED.CreateParameter("RtnNum", adInteger, adParamOutput, 25)
Set prmEMEDoutput3 = cmdEMED.CreateParameter("RtnDept", adVarChar, adParamOutput, 255)
cmdEMED.Parameters.Append prmEMEDinput
cmdEMED.Parameters.Append prmEMEDoutput1
cmdEMED.Parameters.Append prmEMEDoutput2
cmdEMED.Parameters.Append prmEMEDoutput3
' Create recordset by executing the command.
Set cmdEMED.ActiveConnection = EMEDcnn
cmdEMED.Execute
'Get Parameter values
With FrmDocTbl
For x = 0 To 2
prmVal = (x + 1)
.LblDoc(x).Caption = cmdEMED.Parameters(prmVal).Value
Next x
End With
EMEDcnn.Close
End Sub