refreshing a list box

slcollie

Registered User.
Local time
Today, 23:07
Joined
Jun 6, 2000
Messages
20
I am having problems updating my list box.

The first form contains a list of information drawn from a query. Then i am able to open a series of froms to update some or all of that information

However on returning to the original screen the changes are not updated within my list box.

The only way I have got it to update is to requery the deceased list on got focus.

But I want my list box to update as soon as the form reapears not when someone clicks inside it. Where can I put the requery to do this? Or should I use refresh?

Help please
 
On your listbox form try inserting the requery action into the 'got focus' event property of the form not the list box control therefore when the form reappears the listbox will requery. Hope this helps
 
Afraid it didnt work.

So the user still has to click into the list box to update.

Any other ideas?
 
You could try the following code in the "Activate" of your form:
Private Sub Deceased_Activate()
On Error GoTo Deceased_Activate_Err

DoCmd.Requery "Deceased"


Deceased_Activate_Exit:
Exit Sub

Deceased_Activate_Err:
MsgBox Error$
Resume Deceased_Activate_Exit

What this does is requery your list box named deceased when your open form receives the focus and becomes the active window.

Good luck
 
Now the system is being used by a lot of people this refresh won't be enough. I need to update the listbox of user 1 machine even when user 2 is the one who has entered new information......

My head is spinning!
 
If the query for the list box doesn't take too long to run, you could put the requery statement on the "On Current" event of the form. Then, every time the user moves to a new record on the form, the list is refreshed. Watch out, though. Current fires a lot and this may (but may not -- you will have to see) result in performance decrease.

You may want to check out the Timer Function, but it may be complicated to do this. (To create an automatic refresh.)

[This message has been edited by DML (edited 07-07-2000).]
 

Users who are viewing this thread

Back
Top Bottom