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

Recommended Answers

All 4 Replies

It cause your "rsLibrary" is not defined.

You are missing an

End If

after line 9

commented: +1 for eagle eyes :D +14

You are missing an

End If

after line 9

wow..really an eagle eyes :D

You are missing an

End If

after line 9

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.