Hi,
I have a Form, Listbox and a field 'field1'. In 'field1' I search for label, description in table1, and table1 is connected to Listbox so I get in my listbox, only the records that I searched for. In the rowsource of the properties I have a sql the get records when I put something in 'field1'.
Now I want to search on date. I have a field called 'date1' and another field called 'date2'. When I put dates in those boxes I get my records in the listbox that I want. This is the code.
strSQL = "SELECT * FROM [Names] WHERE date >= " & Chr(35) & _
Format(Me.date1, "dd/mm/yyyy") & Chr(35) & " AND date <= " _
& Chr(35) & Format(Me.date2, "dd/mm/yyyy") & Chr(35)
Forms!Names!ListNames.RowSource = strSQL
Me.Requery
When I searched for it, my rowsource stays locked. I want to have to code that clears this search function so I can search in 'field1', but now I can't because the rowsource is locked by the strSQL by searching on date.
How do I solve this so I can search on field1 after I searched on date.
Kind regards
Ugurovic
I have a Form, Listbox and a field 'field1'. In 'field1' I search for label, description in table1, and table1 is connected to Listbox so I get in my listbox, only the records that I searched for. In the rowsource of the properties I have a sql the get records when I put something in 'field1'.
Now I want to search on date. I have a field called 'date1' and another field called 'date2'. When I put dates in those boxes I get my records in the listbox that I want. This is the code.
strSQL = "SELECT * FROM [Names] WHERE date >= " & Chr(35) & _
Format(Me.date1, "dd/mm/yyyy") & Chr(35) & " AND date <= " _
& Chr(35) & Format(Me.date2, "dd/mm/yyyy") & Chr(35)
Forms!Names!ListNames.RowSource = strSQL
Me.Requery
When I searched for it, my rowsource stays locked. I want to have to code that clears this search function so I can search in 'field1', but now I can't because the rowsource is locked by the strSQL by searching on date.
How do I solve this so I can search on field1 after I searched on date.
Kind regards
Ugurovic