Refresh form data after closing pop up form

E

Ed

I have a main form that calls several pop-up forms for making data changes.
The main form displays the current data. If you want to change the data, you
click a button and a pop-up change form opens. After making and confirming
the changes, the pop-up form closes.

I need the data on the main form to be refreshed to display the information
that was changed in the pop-up. I added a button to refresh the data but I
don't want my users to have to press the button to do this.

I tried using the main forms On Active event; however, it doesn't fire when
I close the pop-up form and return to the main form.
 
J

Jeanette Cunningham

Hi Ed,
use the unload event of the popup form to requery (not refresh) the main
form.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
J

Jack Leach

I usually open a popup as acDialog... which will suspend your code (and not
let you go anywhere else) until you close the popup. The requery from your
main form.

Private Sub cmdOpenForm_Click
DoCmd.OpenForm "popupname" Windowmode: acDialog
Me.Requery
End Sub

this works great as long as you dont mind the popup restricting other use in
the app

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
E

Ed

That is how I currently have it setup but it seems like it doesn't always
work. Is it possible that the requery is happening too quick after the
subform is closed?

Also, I'm actually calling the pop-up form from a sub-form of the main form
and so my Me.Requery is being done on the subform. I don't think that makes
a difference but I wanted to clarify my design.

Thanks
 
J

Jack Leach

my Me.Requery is being done on the subform.

I'm not sure, but you may try requerying the mainform, or at least
requerying the subform Control via the mainform. I don't know enough about
how the relationship between main and subforms record work, but I know the
subform records are somehow driven from the main (assuming a standard one-to
many design).

This may do the trick.

I use acDialog like this for all my popups and have never had any issue with
the form not closing quickly enough (the record is saved early in the close
process, so by the time the acDailog releases hold, the save should be well
into place)

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 

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