I have a simple form bound to a table with 4 fields. On the form is an unbound listbox which is used to select a filter string for the table to which the form is bound. There is one problem which I cannot fathom.
I would like the selected item from the listbox to be deselected and the highlight removed after use. I use the AfterUpdate event of the listbox to apply the filter and deselect the item. Unfortunately the item is deselected Ok (Listindex is indeed set to -1) but the item always remains highlighted. I have tried other variations on this with other events but requery is not an option if the record is in save limbo so it has to be AfterUpdate.
This inability to de-highlight is annoying. In this case maybe its just cosmetic but there are other situations where it would be preferable.
Most grateful for any ideas/solutions.
John
Relevant code is:
Private Sub lstHolidayYear_AfterUpdate()
Forms!frmholidays.Filter = FilterString
lstHolidayYear.Selected(lstHolidayYear.ListIndex) = False
' The selected item is still highlighted after this
' but not selected i.e. Listindex is -1 after this
Me.FilterOn = True
Forms!frmholidays.Requery
End Sub
Everything else works exactly as required
I would like the selected item from the listbox to be deselected and the highlight removed after use. I use the AfterUpdate event of the listbox to apply the filter and deselect the item. Unfortunately the item is deselected Ok (Listindex is indeed set to -1) but the item always remains highlighted. I have tried other variations on this with other events but requery is not an option if the record is in save limbo so it has to be AfterUpdate.
This inability to de-highlight is annoying. In this case maybe its just cosmetic but there are other situations where it would be preferable.
Most grateful for any ideas/solutions.
John
Relevant code is:
Private Sub lstHolidayYear_AfterUpdate()
Forms!frmholidays.Filter = FilterString
lstHolidayYear.Selected(lstHolidayYear.ListIndex) = False
' The selected item is still highlighted after this
' but not selected i.e. Listindex is -1 after this
Me.FilterOn = True
Forms!frmholidays.Requery
End Sub
Everything else works exactly as required