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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox which is loaded from a table does not always show new record

Status
Not open for further replies.

Pack10

Programmer
Feb 3, 2010
495
US
I have a routine where the user enters an account number and a query takes that account number and retrieves various account info where it then populates the retrieved info in text boxes on the form. The user then clicks save and the data is written to a table. Once its written to the table, (this works fine), I want to see the info in a listbox. This works sometimes and sometimes it does not display in the listbox.

set db = CurrentDB()
Set rst = db.openrecordset("Fund", dbopenDynaset)
.Fields("Reference_Number") = forms!frmTasks!txtItem
.Fields("Owner") = forms!frmTasks!me.txtOwner
...
.Update
.Close

me.lstFunds.Requery ' sometimes it works sometimes
' it does not.
If I close the form, then re-open, then it shows the refreshed info.
 
Sounds like a timing issue. Sounds like the list requeries faster than the underlying table is updated. You may try adding doevents prior to the requery. You may try resetting the rowsource to buy some time

me.lstfunds.rowsource = ""
me.lstFunds.rowsource = "your original rowsource"
resetting the rowsource does the same as a requery
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top