Is there a way to have a vb code that will autimatically set the focus on a
list box in column 0 and go to the first record that is blank (is null) and
select it? if so, could someone provide me an example of the code...
Alex Dybenko - 19 Jan 2005 06:42 GMT
in order to "goto" (actually it is called select) in list box - set it to a
value of bound column, which one you want to have selected
also you can go through all items, see column property and selected property
in online help

Signature
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com
> Is there a way to have a vb code that will autimatically set the focus on
> a
> list box in column 0 and go to the first record that is blank (is null)
> and
> select it? if so, could someone provide me an example of the code...
Tim Ferguson - 19 Jan 2005 16:16 GMT
> Is there a way to have a vb code that will autimatically set the focus
> on a list box in column 0 and go to the first record that is blank (is
> null) and select it? if so, could someone provide me an example of the
> code...
if columns(0) is the bound column, then you can just iterate the
ItemData collection to find the first non-blank value; otherwise you can
look through the Column(column, row) array to find it.
' r is the row counter
For r = 1 to lisMyList.ListCount-1
If Len(lisMyList.Column(0,r))>0 Then
' found it
lisMyList.Selected(4)=True
Exit For
End If
Next r
' check for all blank
If r = lisMyList.ListCount Then
lisMyList.Enabled = False
End If
or something like that
Hope it helps
Tim F