list box filtering

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a list box on a form that displays a series of locked records in 3 bound columns. When I apply filter to the form, the records get filtered however the list box still shows the bound column names. How do I keep my list box in-sync. w/ the applied filter?
 
If you want to filter your list box at the same time you apply a filter to
your form, you would need to add the filter string to the WHERE clause of
the list box's RowSource.

Assuming the list box is named "MyListBox", and its RowSource is normally
"MyQuery":

Dim strFilter As String
strFilter = "SomeField = 999"
Me.Filter = strFilter
Me.FilterOn = True
Me.MyListBox.RowSource = "SELECT * FROM MyQuery WHERE " & strFilter & ";"

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Keith L. said:
I have a list box on a form that displays a series of locked records in 3
bound columns. When I apply filter to the form, the records get filtered
however the list box still shows the bound column names. How do I keep my
list box in-sync. w/ the applied filter?
 
Back
Top