Hey all --
I have a form with a listbox in it that doesn't seem to be updating fast enough..?? The rowsource is a SELECT statement pulling records from a one-to-many related table. I have a button which opens a modal form, in which the user enters in the details for the child record. When the modal form closes, a listbox.requery runs, but it seems like the requery happens before the table data updates; when I get back to the main form, the listbox shows the new child record, but it still has the default values in it. Here's the code for the Add button:
Set rst = CurrentDb.OpenRecordset("Item", dbOpenDynaset)
' This stuff sets the link field in the child table to the current primary key in the master table
rst.AddNew
rst!nQuoteKey = Me!txtquotekey
nNewKey = rst!pkey
rst.Update
rst.Close
Set rst = Nothing
' open a modal form
QuoteProcs.qOpenForm "modEditItem", "item.pkey = " & nNewKey
' not sure if this does anything, but the help file mentioned it?
DBEngine.Idle dbForceOSFlush
' this requery seems to come before the data is updated!
lstItems.Requery
Can anyone lend a suggestion? Thanks
-- michael~
I have a form with a listbox in it that doesn't seem to be updating fast enough..?? The rowsource is a SELECT statement pulling records from a one-to-many related table. I have a button which opens a modal form, in which the user enters in the details for the child record. When the modal form closes, a listbox.requery runs, but it seems like the requery happens before the table data updates; when I get back to the main form, the listbox shows the new child record, but it still has the default values in it. Here's the code for the Add button:
Set rst = CurrentDb.OpenRecordset("Item", dbOpenDynaset)
' This stuff sets the link field in the child table to the current primary key in the master table
rst.AddNew
rst!nQuoteKey = Me!txtquotekey
nNewKey = rst!pkey
rst.Update
rst.Close
Set rst = Nothing
' open a modal form
QuoteProcs.qOpenForm "modEditItem", "item.pkey = " & nNewKey
' not sure if this does anything, but the help file mentioned it?
DBEngine.Idle dbForceOSFlush
' this requery seems to come before the data is updated!
lstItems.Requery
Can anyone lend a suggestion? Thanks
-- michael~