I have a listbox that is populated depend on my search criteria. Unfortunately it doesn't work. I've also made a button called ViewAll so the user can view all the files if they so choose instead of seeing the search results. I figure if i can get this working the rest would be easier to figure out. I originally had the rowsource as seen by 'strSQL= "SELECT.... but realized I can just use the table as a rowsource.
why does this not work?
Private Sub ViewAll_Click()
Dim strSQL As String
'strSQL = "SELECT Company.CIndex, Company.Company, Company.Location, Company.[Pricing Info] FROM Company"
strSQL = Me.lstResults.RowSource
strSQL = strSQL & "ORDER BY Company.Company"
Me!lstResults.RowSource = strSQL
Me!lstResults.Requery
Me!txtSearch.SetFocus
Me!FrameSortBy.Value = 0
End Sub
why does this not work?
Private Sub ViewAll_Click()
Dim strSQL As String
'strSQL = "SELECT Company.CIndex, Company.Company, Company.Location, Company.[Pricing Info] FROM Company"
strSQL = Me.lstResults.RowSource
strSQL = strSQL & "ORDER BY Company.Company"
Me!lstResults.RowSource = strSQL
Me!lstResults.Requery
Me!txtSearch.SetFocus
Me!FrameSortBy.Value = 0
End Sub