Hi All.
I'm trying to create VBA code to filter ListBox via value of TextBox. On online I found sample that is very similar to what I need
	
	
	
		
But when I run form, type value in TextBox and then press Enter in line  DoCmd.ApplyFilter , sFilter  I got error message:
		
		
	
	
		 
	
How to fix the problem?
Thanks
 I'm trying to create VBA code to filter ListBox via value of TextBox. On online I found sample that is very similar to what I need
		Code:
	
	
	Private Sub txtDate_Exit(Cancel As Integer)
    Dim sFilter As String, oRS As DAO.Recordset
  
    If IsNull(txtDate) Then DoCmd.ShowAllRecords: Exit Sub
  
    DoCmd.ApplyFilter , sFilter
    Set oRS = Me.RecordsetClone
  
    If oRS.RecordCount = 0 Then
        MsgBox "No record matches"
        DoCmd.ShowAllRecords
    End If
  
    Cancel = True
End SubHow to fix the problem?
Thanks
 
	 
 
		 
 
		 
 
		 
 
		