refreshing forms

plgii

Registered User.
Local time
Today, 02:53
Joined
Apr 13, 2006
Messages
15
I have modal pop-up form1 showing list of items. There is a button that opens a new modal pop-up form2 (not subform) to add items to form1, form1 is still open behind form2. This all works fine, but when you click save button on form2 it saves new data to database and closes taking you back to form1
but does not refresh new data to form1 unless you (shift F9) or close form1 and reopen or use refresh button on form1.
I would like to have form1 refresh data as soon as form2 is closed from the save button. I can do a timer event on form1, but this flashes the screen...which is annoying. I have tried various methods to make this work but just can't seem to get it to work. If form2 was a subform of form1 then refreshing mainform would not be an issue. Can anyone shed some light on this?
 
Docmd.requery should do it but the key is When?

If one of your Modal Pop-Ups was a Dialog box, then when the Pop-Up is called from the Main Form, the code will interrupt until the process returns. This could be the point when you want the Requery to happen.

Failing that, flag it in some way and then trigger the Requery on (say) Activate, or Current or some other event.
 
form2 is not a dialog box, it is a tabbed form. I have tried to requery on various events on form1 and form2, but still won't refresh form1 data.
 
This may be a bit clumsy but remember the record number and close the form and re-open it filtered to the right record. It will cause the screen to flash but assuming the db is not massive, it should only be a spilt second. Someone else may have a more classic solution but time is time so this may be an interim fix.
 

Users who are viewing this thread

Back
Top Bottom