Hello there Good Day Guys!
I need your expertise for vb6 guys i made a small program with command search button. Its working. My problem now when i search again with different category it shown this error
Run-time error '3001'
Argument are of the wrong type, or out of acceptable range, or are
in conflict with another.
here's the code:
Private Sub cmdSearch_Click()
Dim EQP As String
With Adodc1.Recordset
If Trim(cmbCategory.Text) <> "" Then
If cmbCategory.Text = "All" Then
txtTitle.Text = ""
txtFDirector.Text = ""
Else
EQP = "Category = '" & cmbCategory.Text & "'"
End If
End If
If Trim(txtFTitle.Text) <> "" Then
EQP = EQP & " and Title like '*" & txtFTitle.Text & "*'"
End If
If Trim(txtDirector.Text) <> "" Then
EQP = EQP & " and Director like '*" & txtFDirector.Text & "*'"
End If
If Trim(txtFVN.Text) <> "" Then
If cmbCategory.Text = "all" Then
EQP = "VideoNumber like '*" & txtFVN.Text & "*'"
Else
EQP = EQP & " AND VideoNumber like '" & txtFVN.Text & "'"
End If
End If
.Filter = EQP
End With
If Adodc1.Recordset.RecordCount > 0 Then
lblAvailable.Caption = "Available: " & Adodc1.Recordset.RecordCount
Else
lblAvailable.Caption = " Available: 0"
MsgBox "No record to Display!", vbInformation, "Filter"
End If
End Sub
Private Sub Form_Load()
With Adodc1.Recordset
cmbCategory.Clear
Dim i As Integer
Dim st As String
Dim b As Boolean
cmbCategory.AddItem "all"
Do While Not .EOF
st = .Fields!category
b = False
For i = 0 To cmbCategory.ListCount - 1
If st = cmbCategory.List(i) Then
b = True
End If
Next
If b = False Then
cmbCategory.AddItem st
End If
.MoveNext
Loop
End With
If cmbCategory.ListCount > 0 Then
cmbCategory.ListIndex = 0
Else
cmbCategory.ListIndex = -1
End If
End Sub