Solved

Subform is not refreshing after update

Posted on 2014-12-21
9
144 Views
Last Modified: 2014-12-22
I have a main form with one subform.  The subform is based upon a query and is linked to the main form based upon two fields.
I have a command button on the main form that brings up a second form that allows me to make changes or additions to the table that the query for the subform on the first form is based on.  When this form closes the first form again gets focus but the changes or additions made to the table do not appear on the subform.  If I move to another record on the main form and then go back to the original record, the changes/additions then show up on the subform.I have tried using the following code to the "On Got Focus" event of the Main form but it does not make a difference:
         Me.subformname.requery
         Me.Refresh
Any help would be greatly appreciated.
0
Comment
Question by:dsoderstrom
  • 4
  • 3
  • 2
9 Comments
 
LVL 49

Expert Comment

by:Gustav Brock
Comment Utility
Try with:

    Me!subformname.Form.Requery

/gustav
0
 
LVL 7

Expert Comment

by:Gauthier
Comment Utility
Well it should work.
maybe me!subformname.requery in case you do something odd (like adding the subform dynamically)
0
 

Author Comment

by:dsoderstrom
Comment Utility
Tried both suggestions. subform still does not update.
0
 
LVL 7

Expert Comment

by:Gauthier
Comment Utility
Other possibilities:
- Check that your on got focus the event is fired (add a debug.print or a breakpoint).

Workaround:
trigger the other subform Requery (if it is opened) in the after_Update of the closing form.
Note that the event normally fire in this order:
After_Update
Close
so the got focus event is normally fired well after the save...
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 7

Expert Comment

by:Gauthier
Comment Utility
ok, tested your case, and for me the got focus is not triggered at all.
0
 
LVL 7

Expert Comment

by:Gauthier
Comment Utility
you must use on activate instead of on got focus
or use my first workaround
0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 500 total points
Comment Utility
Use the OnActivate event.

/gustav
0
 

Author Closing Comment

by:dsoderstrom
Comment Utility
That did it!  works perfectly.
Thank you very much.
0
 
LVL 49

Expert Comment

by:Gustav Brock
Comment Utility
You are welcome!

/gustav
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now