Run-time errror

dwiniers

Right off the assembly line
Hello guys! Good Day!

I need your help guys and expertise. I made a small program for our Prelim examination video rental system. I just stated with the search command button as we required. No the code that i made is almost running. When you first time searching for a category it will work fine. When search again or searching another category it give you an error. You should re start the program again before you can search another category or fields. The error shown:

Run-time error '3001'

Argument are of the wrong type,
are out of acceptable range, or are
in conflict with another.

Again im trying to resolve the problem i got another error its

Run-Time error 3265

Item cannot be found in the collection corresponding to requested
name or ordinal


here's my code:

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
 
Last edited by a moderator:
Top Bottom