Requery of Listbox problem

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

Guest

I have code that navigates a hierarchy of lists in a single listbox. I go up and down levels by pressng 'drill down' and 'drill up' command buttons
When I 'drill up' I need to requery the listbox and also reselect the item that was selected when they 'drilled down'
My question
Which do I do first the Requery or the Me!ListItem.selected = true
When I do the Requery first, I get very strange results, I have to press the command button twice. When I do the Requery second I get an Access error 'You must save the current field before you run the Requery action'
Are both of these methods wrong
 
-----Original Message-----
I have code that navigates a hierarchy of lists in a
single listbox. I go up and down levels by pressng 'drill
down' and 'drill up' command buttons.
When I 'drill up' I need to requery the listbox and also
reselect the item that was selected when they 'drilled
down'.
My question:
Which do I do first the Requery or the Me! ListItem.selected = true
When I do the Requery first, I get very strange results,
I have to press the command button twice. When I do the
Requery second I get an Access error 'You must save the
current field before you run the Requery action'
Are both of these methods wrong?

.
Hi David,
1. store current selected list item...
' assumes list has numeric id in bound column
dim lngItem as long
lngItem=ListItem.value

2. requery list...
ListItem.requery

3. re-select item
ListItem.value=lngItem

Luck
Jonathan
 
Back
Top