list box move highlighted items

C

Cynthia

I have a list box and 3 commands that can be ran on the list move up / move
down / delete. For example when they select item 2, item 5 in the list and
select the button move up shown below, it changes the routenum of item 2 to 1
and of item 1 to 2, then it changes the routenum of item 5 to 4 and of 4 to 5
in the list.
I cannot find a way to keep the items selected highlighted when they move in
the list. Is this possible? When item 2 becomes item 1 in the list I need
item 1 highlighted not 2. If this cannot be done how can a remove the
highlights.

For Each varItem In Me.listCircList.ItemsSelected
ID = Me.listCircList.Column(0, varItem)
num = Me.listCircList.Column(4, varItem)
newnum = num - 1
If num = 1 Then
MsgBox "Cannot move up already at Top of List"
Else
DoCmd.RunSQL "Update EleCircRoute set routenum = " & num & "
where CircID = " & CircID & " and routenum = " & newnum & ""
DoCmd.RunSQL "Update EleCircRoute set routenum = " & newnum
& " where ID = " & ID & ""
End If
Next varItem
Me.Refresh
 

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

Top