Listbox Highlight (Selected)

  • Thread starter Thread starter JamesJ
  • Start date Start date
J

JamesJ

I'm using the following code in thge AfterUpdate of a Listbox
to filter records in another Listbox:

If Me!lstContactFilter.Column(1) = "<<All>>" Then

strAll = "SELECT ContactID, Listing, Phone, ContactType, Notes FROM
tblContactType" _
& vbCrLf & "INNER JOIN tblContacts ON
tblContactType.ContactTypeID = tblContacts.ContactTypeID ORDER BY Listing;"
Me.RecordSource = strAll
Me!lstContacts.RowSource = Me.RecordSource

Else

strSql = "SELECT ContactID, Listing, Phone, ContactType, Notes FROM
tblContactType" _
& vbCr & "INNER JOIN tblContacts ON tblContactType.ContactTypeID
= tblContacts.ContactTypeID WHERE (((tblContacts.ContactTypeID)=" &
[lstContactFilter].[Value] & "))ORDER BY Listing;"
Me.RecordSource = strSql
Me!lstContacts.RowSource = Me.RecordSource

End If

The problem is that after the records get filtered the selected value in
lstContactFilter becomes unselected. What might I do to keep the
selected item 'highlighted?'

Thanks,
James
 
For some reason the tab order prevented the selcted item to remain selected.
Don't know why, but I moved one item down in the tab order and it works
fine.

James
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top