Clear selections in list box based on another list box

TimTDP

Registered User.
Local time
Today, 22:00
Joined
Oct 24, 2008
Messages
213
On a form I have two list boxes.
The recordset for the second list box is based on the record selected in the first list box

When I select a record in the fist list box I want to clear any previously selected record in the second list box. I have tried the following:
Code:
Private Sub lstSupplier_Click()
[INDENT]For varItem = 0 To Me.lstCustomer.ListCount - 1
    Me.lstCustomer.Selected(lrow:=varItem) = False
Next
Me.lstCustomer.Requery
[/INDENT]End Sub

But in the following scenario:
* I make a selection in list box 1 and a selection in list box 2
* Change the selection is list box 1
* Change the selection is list box 1 back to the one originally selected
The record in list box 2 is still highlighted!

How do I prevent this?
If the record selected in list box 1 changes, I never want to see a record selected in list box 2

Thanks in advance
 
Private Sub lstSupplier_Click()
Me.lstCustomer = null
Me.lstCustomer.Requery
End Sub
 

Users who are viewing this thread

Back
Top Bottom