Solved

Subform is not refreshing after update

Posted on 2014-12-21
9
154 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
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…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

724 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