focus in listboxes

  • Thread starter Thread starter marco
  • Start date Start date
M

marco

Is it possible to set the focus to a particular record in
a list box? (so not to the box itself, but to an 'item' in
the box)

Thanks,


Marco van Haaften
 
Is it possible to set the focus to a particular record in
a list box? (so not to the box itself, but to an 'item' in
the box)

Sure, but that means actually setting the value of the listbox as in the
following examples (this assumes that the listbox's "Multiselect" property is
set to "None"):

If the bound column in the listbox is a number ...

Me.MyListBox.Value = 22

Or, if the bound column in the listbox is a string ...

Me.MyListBox.Value = "A35M7"

And, if you simply want to set the value to the first item in the list,
regardless of the value, you can use (automatically accommodates the listbox's
"ColumnHeads" property setting):

Me.MyListBox.Value = Me.MyListBox.ItemData(Abs(Me.MyListBox.ColumnHeads))
 

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

listbox and set focus 1
Search Unbound Column in List Box 5
Error 2115 and Listbox 3
Access Cannot select items in listbox 1
Pop Up Form Focus Question 1
Pop Up Form Focus Question 1
set default focus to nothing? 1
Losing Focus 2

Back
Top