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

forms too quick for tables? 1

Status
Not open for further replies.

thatguy

Programmer
Aug 1, 2001
283
US
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~
 
Doh! ok I just noticed that the code execution doesn't pause when the modal form is open (I'm used to FoxPro where it Does pause). So I'll change my question:

Can anyone suggest a way to pause the code until the modal form is closed, and Then run the listbox.requery? Or do I have to put the requery in the modal form's close button? Isn't the latter a bit messy? ... seems to me there should be a better way than hard-coding an inter-form call like that. ... maybe I'm just too used to foxpro? At any rate, any suggestions?

-- michael~
 
Hi,

Open the form in acDialog mode, e.g.

Code:
' Open a form that will effect the rowsource of me.lstitems
docmd.openform "myForm",,,,,acDialog


' The following line will not execute until frmMyForm has closed
me.lstItems.requery




 
... huh... that's pretty simple. *awkward silence* uh... Thanks!

-- michael~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top