I received the message above after executing a stored procedure from my ado code. The error appeared in the recordcount property of the If statement. Here is how my sub routine looks like:
Private Sub w_o__history_Click()
On Error GoTo Err_w_o_history_Click
Dim ret_val As Integer
Dim check_wo_history As New ADODB.Command
Dim rs_check_wo_history As New Recordset
Dim work_ord_num As String, work_ord_line_num As String
Call load_const
With check_wo_history
.ActiveConnection = CurrentProject.Connection
.CommandText = "spCheck_wo_history"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("ret_val", adInteger, adParamReturnValue)
''''.Parameters.Append .CreateParameter("@mfg_ord_num", adChar, adParamInput, mfg_ord_num_length, mfg_ord_num)
.Parameters.Append .CreateParameter("@work_ord_num", adChar, adParamInput, work_ord_num_length, Me!shipping_sched_list_subform.Form!work_ord_num.Value)
.Parameters.Append .CreateParameter("@work_ord_line_num", adChar, adParamInput, 3, Me!shipping_sched_list_subform.Form!work_ord_line_num.Value)
Set rs_check_wo_history = .Execute
End With
''''ERROR OCCURRED ON THE NEXT LINE OF CODE
If rs_check_wo_history.RecordCount > 0 Then
DoCmd.OpenForm "shipment_hist_list"
Else
MsgBox "There are no shipments found for Work Order Number: " & work_ord_num & " ", vbExclamation
end if
end sub
Thanks in advance.
Private Sub w_o__history_Click()
On Error GoTo Err_w_o_history_Click
Dim ret_val As Integer
Dim check_wo_history As New ADODB.Command
Dim rs_check_wo_history As New Recordset
Dim work_ord_num As String, work_ord_line_num As String
Call load_const
With check_wo_history
.ActiveConnection = CurrentProject.Connection
.CommandText = "spCheck_wo_history"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("ret_val", adInteger, adParamReturnValue)
''''.Parameters.Append .CreateParameter("@mfg_ord_num", adChar, adParamInput, mfg_ord_num_length, mfg_ord_num)
.Parameters.Append .CreateParameter("@work_ord_num", adChar, adParamInput, work_ord_num_length, Me!shipping_sched_list_subform.Form!work_ord_num.Value)
.Parameters.Append .CreateParameter("@work_ord_line_num", adChar, adParamInput, 3, Me!shipping_sched_list_subform.Form!work_ord_line_num.Value)
Set rs_check_wo_history = .Execute
End With
''''ERROR OCCURRED ON THE NEXT LINE OF CODE
If rs_check_wo_history.RecordCount > 0 Then
DoCmd.OpenForm "shipment_hist_list"
Else
MsgBox "There are no shipments found for Work Order Number: " & work_ord_num & " ", vbExclamation
end if
end sub
Thanks in advance.