Return Focus to Selected Item in a ListBox

  • Thread starter Thread starter Ross
  • Start date Start date
R

Ross

I am updating values in a record on a Listbox. How can I return focus to the
item selected for updating once the update is complete and the listbox has
been .requeried to display the updated results.

PS .recordset clone seems useful only when the recordset source is imbedded
in the form (my recordset source is imbedded in the listbox)


Many Thanks

Ross
 
Ross said:
I am updating values in a record on a Listbox. How can I return focus to the
item selected for updating once the update is complete and the listbox has
been .requeried to display the updated results.

PS .recordset clone seems useful only when the recordset source is imbedded
in the form (my recordset source is imbedded in the listbox)


Try using the list box's Recordset property.
 
Ross said:
I am updating values in a record on a Listbox. How can I return focus to
the
item selected for updating once the update is complete and the listbox has
been .requeried to display the updated results.

PS .recordset clone seems useful only when the recordset source is
imbedded
in the form (my recordset source is imbedded in the listbox)


Many Thanks

Ross

Unless I misunderstand you, all you need to do is set the listbox's .Value
property following the requery:

MyListbox.Value = <current value>

The listbox will then search it's internal Values collection for a match,
then displays the selection bar on the required value.
 
Stewart,

I finally got around to trying this and it workes perfectly.
I first had to define a key field (Zone & UPC_CD) for the first position in
the list box.

For others future use:

On _Click
myVariable = myListBox.value

and then after the listbox.requery
Then
MyListbox.Value = <current value>

and focus returns to myVariable!!!
 
Back
Top