How can I show a MS-Access listbox row highlighted? I'm using MS-Access 2007. I want the first row of a multiple-column listbox to be showed highlighted through VBA.
I tried Me.LstSample.Selected(0) = True
, but it doesn't work.
The code:
Private Sub LstStation_AfterUpdate()
With Me.LstSample
If IsNull(Me.LstStation) Then
.RowSource = ""
Else
.RowSource = _
"SELECT * FROM Samples WHERE S='" & Me.LstStation.Value & "'"
End If
Call .Requery
If Not IsNull(Me.LstStation) Then
Me.LstSample.Selected(0) = True
End If
End With
End Sub