Refresh calling form

J

JimS

frmBoM opens PoPupItemMastSelect. (ItemMasterSelect is not yet a popup or
modal...it will be when I'm done debugging)

I want PoPupItemMasterSelect to add a row to a table, then cause the calling
form (frmBoM) to show that new row immediately, even though it doesn't have
focus. Currently PoPupItemMasterSelect issues a Forms("frmBoM").requery. I
have also tried .refresh. Not happening. What am I doing wrong?
 
J

Jeanette Cunningham

Hi JimS,
Assuming that the calling form is open at the time you want to requery it,
make sure you call the requery after PoPupItemMastSelect has saved the new
row to the table. You could use the after update or the unload event.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
J

JimS

.....and there's the rub. The recordsource for the popup is not the same table
as the recordsource for the calling form. In fact, the update is done with a
call to a class method, which uses the currentdb.execute command to add the
item. Still, enough time passes for the db to have been updated.
Particularly, when I add two items 20 seconds apart from one another, the
form(...).requery doesn't even catch items added 20 seconds ago. But if I
close the popup and hit F5, it shows all the added records immediately.

Strange
 
J

Jeanette Cunningham

We need to check that the records are actually added to the table using the
class method while the popup form is open.

This is just a guess, but perhaps the update doesn't run until the popup is
closed.

You can check by adding the record using the popup.
While both forms are open, open the table where the records should have
gone and check that have been added to the table.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
J

JimS

OK, no matter how I add the records, they ARE available to the calling form.
I add the record, then (leaving the called form open...) go to the calling
form and hit F5. The new record shows up. Perhaps I didn't mention that the
calling form is Filtered. In any case, I changed back to native Access
(docmd.runsql...) and that had no effect. I undid that and issued a
forms("...").filteron=false, then filteron=true. That worked, but in a
somewhat disruptive way. So, I changed it to issue a
forms("...").filter=forms("...).filter. That worked and was not disruptive.

Having a workaround, my curiosity is now sublimated to my schedule. Thanks
for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top