Solved

Subform is not refreshing after update

Posted on 2014-12-21
9
153 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 40511749
Try with:

    Me!subformname.Form.Requery

/gustav
0
 
LVL 7

Expert Comment

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

Author Comment

by:dsoderstrom
ID: 40511986
Tried both suggestions. subform still does not update.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:Gauthier
ID: 40511996
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
 
LVL 7

Expert Comment

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

Expert Comment

by:Gauthier
ID: 40512017
you must use on activate instead of on got focus
or use my first workaround
0
 
LVL 50

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 40512019
Use the OnActivate event.

/gustav
0
 

Author Closing Comment

by:dsoderstrom
ID: 40512132
That did it!  works perfectly.
Thank you very much.
0
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 40512481
You are welcome!

/gustav
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

749 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