PDA

Click to See Complete Forum and Search --> : Listindex


Zach Ahmed
Jun 7th, 2004, 08:06 AM
Hi All:
How can I select the Listindex of a combobox or listbox?

I am populating the combobox in the following manner:

For i = 1 To oRecData.RecordCount
With Form2.cmboevebldg
sDesc = oRecData.Fields("Location_Name") & Space(60) & "$" & CStr(oRecData!Location_ID)
.AddItem sDesc
.ItemData(.NewIndex) = oRecData!Location_ID
End With
oRecData.MoveNext
Next i

I need the location_ID

Thanks:afrog:

BrianB
Jun 8th, 2004, 02:32 AM
I do not fully understand your code, but ListIndex is a number starting at zero that determines the selection. So this selects the first item in the combobox :-


Form2.cmboevebldg.ListIndex = 0

Zach Ahmed
Jun 8th, 2004, 07:10 AM
Hi BrianB:
Thanks for getting back to me. I got the answer I was looking for.

Thanks again