Scroll a list box to selected item (Repost)

  • Thread starter Thread starter Nelson
  • Start date Start date
N

Nelson

I have code that selects an item in a list box that works fine (below) but I
would like to add code to scroll down to the selected item to show it. The
ListBox.Mutiselect is set to extended (3)

Anyone know how I would do that?
TIA
Nelson

If OpenArgs <> "" Then
For i = 0 To PatientList.ListCount - 1
If PatientList.ItemData(i) = OpenArgs Then
PatientList.Selected(i) = True
Exit For
End If
Next i
If i = PatientList.ListCount Then
DoCmd.Close
MsgBox "There are no claims to print for this patient."
End If
End If
 
You can set the ListIndex prop to your var "i" in the sample code you
posted. Remember, the ListBox control MUST have the focus in order for
you to be able to write to the ListIndex prop.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Stephen,

That did it! Thanks! I didn't try the listindex property since VB help
states it is read only. Thanks again.

Nelson
 
Back
Top