I need to refresh!!

raychoy2k

Registered User.
Local time
Today, 05:48
Joined
Feb 24, 2003
Messages
29
I have a form that opens a popup, then when the popup is closed I would like the form to refresh so it can reflect the changes made.

(The popup makes changes to the subform in the original form. It would be nice to have it refresh and show new changes one I go back to the form)

I tried OnActivate and OnCurrent. Neither work. Any suggestions?

Thanks from Newbie Man!
 
Try adding the following on the On Close event of the POP-UP:

[Forms]![NameofForm].Refresh

or

[Forms]![NameofForm].Requery (if it is built from a query)

HTH
 
Refresh and Requery do NOT do the same thing. Look them up in help for complete definitions. This situation requires a requery.

The Refresh method shows only changes made to records in the current set. Since the Refresh method doesn't actually requery the database, the current set won't include records that have been added or exclude records that have been deleted since the database was last requeried. Nor will it exclude records that no longer satisfy the criteria of the query or filter. To requery the database, use the Requery method. When the record source for a form is requeried, the current set of records will accurately reflect all data in the record source.
 
Yo JF, you are right.

I think that should work. Let me try.

I feel stupid for no thinking of that one. I did a refresh with the OnActivate on the original form instead.

It doesn't use a query, so a requery will not help in this case.

Thanks for the suggestions though.
 
Pat:
Note how I put:

(if it is built from a query)

Since it was not stipulated how the form was built I suggested both.

You clarification is noted.
 
A recordset is a recordset is a recordset. ALL recordsets originate from tables. That is where data is stored after all. The comment from help that I posted refers to a recordset NOT a query. Therefore, there is no difference between a recordset based directly on a table (Access simply builds a query in the background to obtain the data for you) and that based on a query. There is no magic to the query that Access creates for you when you open a table. It is this little fact that clarifies why queries and tables are interchangeable for most purposes. They are both queries to Access. Most people think that when they open a table, they are looking at something physical as if they opened a sequential text file with a text editor. Not so. They are looking at a recordset, which was obtained by running a query to retrieve the data from the physical table. The only way to look at a table in situ (so to speak) is to open an Access .mdb with a text editor and see if you can figure out where the data is.
 
Quite an old thread, but I have a suggestion if it's still wanted. I would use the .Recalc command at the end of the expression. This seems to do what you're wanting!
 
No, .recalc will not requery the recordsource.

Requery, Recalc, Refresh, Repaint

From help:
F9
To recalculate the fields in the window
SHIFT+F9
To requery the underlying tables; in a subform, this requeries the underlying table for the subform only
F9
Refresh the contents of a Lookup field list box or combo box
 
something that simple

Thanks for the info on Shift-F9 and F9. It is exactly what I needed to resolve my issue I was having on a subform that needed to be 'refreshed' with new data added to the primary form.
 

Users who are viewing this thread

Back
Top Bottom