Stuart McLachlan
stuart at lexacorp.com.pg
Wed May 3 19:23:24 CDT 2006
On 4 May 2006 at 7:52, Tom Keatley wrote: > > The code below works fine for the single value but I need to loop thru > the values in my first line to make it work.....should be simple but I > simply cant get it to work > > Dim intI As Integer > Dim strIDValue As String > strIDValue = 73221 > For intI = 0 To Me!listcon1.ListCount - 1 > If Me!listcon1.ItemData(intI) = strIDValue Then > Me!listcon1.Selected(intI) = True > End If > Next intI > This code will select line 73221 > Aircode so it may need some debugging, but the general idea is there: Dim intI As Integer Dim intl2 as Integer Dim strIDValue As String Dim strIDs() as String Dim strCurrentValue as String strIDValue = "73221,7259,13771,2" strIDs() = split(strIDValue,",") For intl2 = 0 to ubound(strIDs) strCurrentValue = strIDs(intl2) For intI = 0 To Me!listcon1.ListCount - 1 If Me!listcon1.ItemData(intI) = strCurrentValue Then Me!listcon1.Selected(intI) = True End If Next intI Next intl2