Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Reply
 
LinkBack Thread Tools Display Modes
Old 06-01-2012, 01:12 PM   #1 (permalink)
Right Off the Assembly Line
 
Join Date: Jan 2012
Posts: 1
Arrow Run-time errror


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 krishnandu.sarkar; 06-01-2012 at 01:18 PM. Reason: updated with code tags
dwiniers is offline   Reply With Quote
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 16-01-2012, 02:44 PM   #2 (permalink)
In The Zone
 
Join Date: Mar 2004
Location: Welcome to the Matrix
Posts: 215
Default Re: Run-time errror

You should do a recordset.MoveFirst when RecordCount > 0, when Search button is clicked.
__________________
----
enjoy is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:38 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2