Requery a list after Add Item

ddrew

seasoned user
Local time
Today, 08:54
Joined
Jan 26, 2003
Messages
911
Im trying to requery a list after adding an item. My code is in the Before Update Control and the code i'm using is

DoCmd.Requery "Itemlist"

But its not updating, I seem to recall there should be a line below it but I cant remember what it is!
 
Shoulden't the requery be in the After_Update event instead?

Private Sub ListBox_AfterUpdate()
Me!Listbox.Requery
End Sub
 
The code in which you are adding the item just put following line at the end

Me.LstItems.Requery
 
What version of Access are you running? In v2003 you don't need to requery after adding an item using the AddItem property for a list box. There's really nothing to 'requery' as the RowSource is a Value List, not a Table/Query.

Also note that when you change a control's value in code, the control's events such as BeforeUpdate and AfterUpdate do not fire. You'd have to Call them to get them to fire in this case.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom