G
Guest
I have the following command button code to run an Insert SP:
im cmd As ADODB.Command
Dim pmt As ADODB.Parameter
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "sproc_NewEnrollment"
''Create Paramters required by the SP
Set pmt = cmd.CreateParameter("@ContactID", adInteger, adParamInput, ,
Me.ContactID)
cmd.Parameters.Append pmt
Set pmt = cmd.CreateParameter("@ScheduleID", adInteger, adParamInput, ,
Me.ScheduleID)
cmd.Parameters.Append pmt
Set pmt = cmd.CreateParameter("@PO", adChar, adParamInput, , Me.PONum)
cmd.Parameters.Append pmt
''Execute the SP
cmd.Execute
But i keep getting a "parameter Object inproperly defined" for the set pmt
line for @PO, the insert works fine manually running the SP, but throws an
error using the above VB with a button. PONum is a standard form textbox and
the underlying datatype is char. Please help. thanks
im cmd As ADODB.Command
Dim pmt As ADODB.Parameter
Set cmd = New ADODB.Command
Set cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "sproc_NewEnrollment"
''Create Paramters required by the SP
Set pmt = cmd.CreateParameter("@ContactID", adInteger, adParamInput, ,
Me.ContactID)
cmd.Parameters.Append pmt
Set pmt = cmd.CreateParameter("@ScheduleID", adInteger, adParamInput, ,
Me.ScheduleID)
cmd.Parameters.Append pmt
Set pmt = cmd.CreateParameter("@PO", adChar, adParamInput, , Me.PONum)
cmd.Parameters.Append pmt
''Execute the SP
cmd.Execute
But i keep getting a "parameter Object inproperly defined" for the set pmt
line for @PO, the insert works fine manually running the SP, but throws an
error using the above VB with a button. PONum is a standard form textbox and
the underlying datatype is char. Please help. thanks