Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Requerying list boxes

Status
Not open for further replies.

DavidCat

Programmer
Nov 19, 2000
10
AU
I have the following code which uses the update statement to update data in a table for the items which are selected in a listbox on a form, which works fine. My problem is after the data is updated, how do I refresh the listbox? I tried putting me![listbox].Requery after the loop, but it doesnt work. At the moment I have to have to set the timer interval to about 10 seconds, the do the requry bit in there, which works, but how do I get it to requery only after the data has updated? I tried putting it in just before the Next statement so it would update everytime it looped thru the selected items, but that also didn't work.

For Each varDrgNo In ctl.ItemsSelected
dbs.Execute "UPDATE [TBL_Drawings] " _
& "SET Issue = 'I' " _
& "WHERE DrawingNo = """ & ctl.ItemData(varDrgNo) & """;"
Next varDrgNo
 
Hi,
Why don't you try to set the rowsource property of the list box after the loop and then try requerying?

Something like:


Me.List1.RowSource="Select * from customerNames"
Me.List1.Requery

Hope it helps. Let me know what happens.
With regards,
PGK
 
thanks for that, but unfortunately it still didn't work. I need a way to only make it requery after the data has actually updated. Even though I requery it after it has gone thru the loop, it seems like it is still updating when I requery it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top