Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

listbox populating

Status
Not open for further replies.

skate

Technical User
Nov 29, 2002
65
CA
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
 
Private Sub ViewAll_Click()
Dim strSQL As String
strSQL = "SELECT Company.CIndex, Company.Company, Company.Location, Company.[Pricing Info] FROM Company"
strSQL = strSQL & "ORDER BY Company.Company"
lstResults.RowSource = strSQL
lstResults.Requery
txtSearch.SetFocus
FrameSortBy.Value = 0
End Sub Christiaan Baes
Belgium
"What a wonderfull world" - Louis armstrong
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top