Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Requery Issue 1

Status
Not open for further replies.

Taff82

Programmer
Feb 11, 2004
43
GB
Hi all,

I have a a form with a listbox on. When I click a command button it opens a form depending on what I have selected in my listbox.

When the listbox is requeried it automatically selects the top record from my listbox. It is possible to requery the listbox but keep the record I originally had selected - Selected?

Thanks

Taff
 
Hi

How about:

Dim SavedSelection

SavedSelection = MyListBox
MyListBox.requery
MyListBox = SavedSelection

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hi Ken,

Thanks for the reply, unfortunately it still selects the top value of the listbox.

Regards,

Taff
 
How are ya Taff82 . . . . .

Try this:
Code:
[blue]Dim LBx As ListBox, idx As Long

Set LBx = Me![purple][b]YourLisBoxName?[/b][/purple]
idx = LBx.ListIndex

LBx.RowSource = LBx.RowSource [green]'requeries with no selection[/green]
LBx.Selected(idx) = True[/blue]

Calvin.gif
See Ya! . . . . . .
 
Thanks AceMan,

Works great, exactly what I was after.

Taff.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top