Full Version: find and select a record in a listbox
UtterAccess Forums > Microsoft® Access > Access Forms
cablecity
hello from greece
I have the focus in the listbox2.
I want to find and select a record in listbox1 (i have store the listbox1.value of the record i want to go)
how can i do this????
thanks for your time,
cablecity, greece
BrianS
you will need to loop through the listbox values using the listIndex property. During each iteration of the loop you can examine the value of the listbox and grab that value. I don't have Access installed on this machine and my vba skills are pretty rusty but basically you will use a for loop along with the listIndex property which is zero based.
omething list this
CODE
Dim someVal as String
for i = 0 to (yourList.ListCount - 1)
   if yourList.listIndex(i).value = "Some Value" then
      someVal = yourList.listIndex(i).value
   end if
next
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.