Return Focus to Selected Item in a ListBox

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
 
M

Marshall Barton

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

Stuart McCall

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

Ross

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

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

Top