How to Update Combo Box Query from Form

  • Thread starter Thread starter Brian Reed
  • Start date Start date
B

Brian Reed

I have an access form that I am coding in my Access XP database. One of the
controls on the form is a list box that uses a query to fill its data set.
The problem that I am having is in trying to update the query while the form
is open. The form is used to add users and when I add a user via the form I
want to the control to rerun the query without closing and opening the form
again. Is there anyway to do this?

thanks,

brian
 
What I usually do is just add code like this to the On
Enter event of the combo box

me.NameOfComboBox.Requery

If you haven't done much VBA programming with forms, let
me know and I will explain what I mean.
 
Hi Brian

You just need to requery the list box when the list is likely to have
changed. In your case this will be after a record has been added, so you
should use the AfterInsert event procedure:
Me![My Listbox name].Requery

You might find you need to do it after records are deleted too, and also
after the name has been changed and the record saved.
 
Back
Top