How can I GoToRecord in a List box?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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...
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

GoToRecord 2007 1
Using GoToRecord with DLookUp 2
GoToRecord for a subform 4
Focus in a list box 4
GoToRecord 6
list box question 5
GotoRecord with a variable 1
How to read 2nd column of a list box? 2

Back
Top