Full Version: List Box Update
UtterAccess Forums > Microsoft® Access > Access Forms
ebwhittaker
I have a list box that needs to be updated based on a Query. When I change the main form record to another user the list box is supposed to show those records in the query. the query works correctly but the list box does not get updated.
o I need some advice on how to update the listbox when a new record is selected. The listbox is tied to the Query and the query does work correctly, it is just that the listbox does not get updated to show the query's new listings
thanks for any assistance on this
ed
theDBguy
Hi ed,
Have you tried doing a requery? For example:
Me.ListboxName.Requery
Hope that helps...
ebwhittaker
Hi
Actually I did try the requery but I guess I was not sure where to put it. I tried under the Lastname on event areas but these don't take affect unless the actual field data is changed.
So, Please let me know where to put the requery entry
Thanks
ed
Mr. B
You should place the code in the After Update event of your main form.
If your list box is in the main form you can use:
Me.ListboxName.Requery
If your list box is in a different form, you will need to use:
Forms!NameOfForm!ListboxName.Requery
Of course it is understood that you would use the actual names of the list box and the form in the code(s) above.
ebwhittaker
In the Main Form Properties under Events, After Update, I put in a Stop command just to check to see if this would work. I was able to move between records without this being triggered so I am not certain if the requery here would work? Or did I do something wrong, which is, of course,quite possible
Just to be sure I stated it correctly - I want the Query, and thus the listbox, to update when the user moves from one record to another, not make changes to a particular record.
thanks
ed
theDBguy
Hi ed,
Not sure if I understand your setup ocrrectly but try using this in the Form's Current event:
Me.ListboxName.Requery
Hope that helps...
ebwhittaker
Hi DBGuy
Of course that worked, as all your help does .... thanks again
Thanks again
ed
theDBguy
Hi ed,
Mr. B and I are happy to help. Good luck with your project.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.