Chance1234
IS-IT--Management
firstly whjy is it thjat whjen you hjave one day left to do somethjing your keyboard decides to play up ? gfrrr anyway
what im tryingf to do is use multiple list boxes with multiple criteria to filter another list.
to make more sense, there is a picture of the form here
dont blame me on thje colour schjeme, clients choice not mine.
on the right is a list of clients, thjis is thje list i want to filter, thjis list is called "lstcustom" to thje righjt of that list is a series of othjer list boxes called crit1, crit2 etc respectivly. these lists refer to columns in the query that is beingf used as the row source for lstcustom.
Thjey are all set up as multiple select , and what i want to do is allow thje user to select whjatever values they want in thje list box then by pressingf thje apply button , thje list will filter to thjere options.
now with one listbox it isnt too bad in my code i loop thjrogh the list box to create a where statement, somethingf like this
For i = 0 To crit1.ListCount - 1
If lstCriteria.Selected(i) Then
strWhereIN = strWhereIN & " " & lstCrit1.Column(0, i) & ","
End If
Next i
strWhere = " WHERE " & [Client Sector] & " in (" & Left(strWhereIN, Len(strWhereIN) - 1) & "
"
which i then add onto the end of "SELECT * FROM qrycustom1 " & strwhere , then i set this as the rowsource for lstcustom
no problemo !
but as you can see from the picture i have four listboxes, what i want to be able to do is set up for any possible combination , i hjad an idea of usingf tix boxes and dependingf on whjichj tickboxes are tick, addingf in the word "AND" to the SQL statement but i cant quite gfet my hjead around it
hjelp!
Chance
what im tryingf to do is use multiple list boxes with multiple criteria to filter another list.
to make more sense, there is a picture of the form here
dont blame me on thje colour schjeme, clients choice not mine.
on the right is a list of clients, thjis is thje list i want to filter, thjis list is called "lstcustom" to thje righjt of that list is a series of othjer list boxes called crit1, crit2 etc respectivly. these lists refer to columns in the query that is beingf used as the row source for lstcustom.
Thjey are all set up as multiple select , and what i want to do is allow thje user to select whjatever values they want in thje list box then by pressingf thje apply button , thje list will filter to thjere options.
now with one listbox it isnt too bad in my code i loop thjrogh the list box to create a where statement, somethingf like this
For i = 0 To crit1.ListCount - 1
If lstCriteria.Selected(i) Then
strWhereIN = strWhereIN & " " & lstCrit1.Column(0, i) & ","
End If
Next i
strWhere = " WHERE " & [Client Sector] & " in (" & Left(strWhereIN, Len(strWhereIN) - 1) & "
which i then add onto the end of "SELECT * FROM qrycustom1 " & strwhere , then i set this as the rowsource for lstcustom
no problemo !
but as you can see from the picture i have four listboxes, what i want to be able to do is set up for any possible combination , i hjad an idea of usingf tix boxes and dependingf on whjichj tickboxes are tick, addingf in the word "AND" to the SQL statement but i cant quite gfet my hjead around it
hjelp!
Chance