krazykasper
Registered User.
- Local time
- Today, 09:47
- Joined
- Feb 6, 2007
- Messages
- 35
I have a Multi-Column List Box named List10 that is populated via a query (qry_OptimizeIt3). I’m looking to create three Buttons, one above each column that will re-sort the list in ascending order based on the specific column. For example:
FIRSTNAME LASTNAME AGE
John Doe 24
Bill Jones 43
Judy Smith 21
Sally Johnson 38
I thought I could have each button change the RowSource order of the List Box using simple VBA code; something like:
Private Sub SortOrder1_Click()
List10.RowSource = CurrentDb.QueryDefs(qry_OptimizeIt3a).SQL & " ORDER BY " & strFIRSTNAME
End Sub
However, this gives me the error message “Item not found in this collection” and points to the line List10.RowSource = CurrentDb.QueryDefs(qry_OptimizeIt3a).SQL & " ORDER BY " & strFIRSTNAME
I appreciate any input you can provide.
Krazy (Bill) Kasper
FIRSTNAME LASTNAME AGE
John Doe 24
Bill Jones 43
Judy Smith 21
Sally Johnson 38
I thought I could have each button change the RowSource order of the List Box using simple VBA code; something like:
Private Sub SortOrder1_Click()
List10.RowSource = CurrentDb.QueryDefs(qry_OptimizeIt3a).SQL & " ORDER BY " & strFIRSTNAME
End Sub
However, this gives me the error message “Item not found in this collection” and points to the line List10.RowSource = CurrentDb.QueryDefs(qry_OptimizeIt3a).SQL & " ORDER BY " & strFIRSTNAME
I appreciate any input you can provide.
Krazy (Bill) Kasper