Refresh a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form where the user opens another form (leaving the original form
open) by clicking on a button. The second form that opens allows the user to
add information to a table. When the user saves the record and closes the
form, I would like to update the original form with the information the user
just saved.

Now I don't know if this is going to cause a problem, but the original form
has a set of records meeting the criteria of a search form, and the user
could have moved to any record in the set. I want the form to remain on the
record selected when the user clicked the button, but this is where I also
want to refresh (if that is the right term) the form.

I have read through the Event Procedures, and perhaps I missed it, but I
could not find an event that would handle this.

Do I have to code this so the form is closed when the user clicks the
button, then re-open it after the user makes the changes? If so, how do I
keep the record on the one the user selected.

Thanks in advance.
 
In the form which is opened first (e.g. frm1), add a public sub which is
similar to the following:

Public Sub UpdateRst
Me.Requery
End Sub

In the second form (e.g. frm2) , add the following to the form close event:

Form_frm1.UpdateRst

This should then call the UpdateRst sub from frm1.
 
Thanks, now I forgot to say that the form that opens, can be opened by
several different forms. How would the code work since these forms have
different names?

Cheers
 
Back
Top