Can someone give me some assistance? I'm not sure how to use the where clause. I have a listbox in which i want to use to display a filtered list of records showing only items checked yes as a "hot list" item. When I hit the toggle button it should display this. Instead, it rearranges my list of items in sort strange order and still displays all the records.
Private Sub ToggleHotList_Click()
Dim txtSearchString As Variant
Dim strSQL As String
'strSQL = "SELECT [Files].[File Index], Files.[Hot List], [Customer].[Customer ID], [Files].[Project], [Files].[Eng], [Files].[Proposal], [Files].[Mill Company], [Files].[Mill Location], [Files].[Description], Files.[Detail Desc] FROM Files INNER JOIN Customer ON [Files].[Customer Index]=[Customer].[Customer Index]"
strSQL = strSQL & "WHERE ((Files.[Hot List]) = Yes) "
strSQL = strSQL & "ORDER BY Files.[Hot List]"
Me!lstResults.RowSource = strSQL
Me!lstResults.Requery
Me!txtSearch.SetFocus
End Sub
Private Sub ToggleHotList_Click()
Dim txtSearchString As Variant
Dim strSQL As String
'strSQL = "SELECT [Files].[File Index], Files.[Hot List], [Customer].[Customer ID], [Files].[Project], [Files].[Eng], [Files].[Proposal], [Files].[Mill Company], [Files].[Mill Location], [Files].[Description], Files.[Detail Desc] FROM Files INNER JOIN Customer ON [Files].[Customer Index]=[Customer].[Customer Index]"
strSQL = strSQL & "WHERE ((Files.[Hot List]) = Yes) "
strSQL = strSQL & "ORDER BY Files.[Hot List]"
Me!lstResults.RowSource = strSQL
Me!lstResults.Requery
Me!txtSearch.SetFocus
End Sub