Hello there VB6 masters,

I need you help guy for this compile error: End with without with. I got the syntax in line no.33 Thanks in advance!

Private Sub cmdSearch_Click()
Dim sql As String

    With rsLibrary
    
        If Trim(Combo1.Text) <> "" Then
            If Combo1.Text = "All" Then
            txtTitle = ""
            txtDirector = ""
        Else
            sql = "Category = '" & Combo1.Text & "'"
        End If
        
        If Trim(txtTitle.Text) <> "" Then
            sql = Ssql & "  AND Title like '*" & txtTitle.Text & "*'"
        End If
        
        If Trim(txtDirector.Text) <> "" Then
            sql = sql & " AND Director like '*" & txtDirector.Text & "*'"
        End If
        
        If Trim(txtBN.Text) <> "" Then
            If Combo1.Text = "All" Then
                sql = "BookNumber like '*" & txtBN.Text & "*'"
            Else
                sql = sql & " ANN  BookNumber like '*" & txtBN.Text & "*'"
            End If
            
        End If
        
        .Filter = sql
        
    End With
    
    If rsLibrary.RecordCount > 0 Then
        cmdFirst_Click
    Else
        MsgBox "No record to display!", vbInformation, "Filter"
    End If
End Sub

You are missing an

End If

after line 9

Thank you guys problem solved..........

This question has already been answered. Start a new discussion instead.