?
Solved

Subform is not refreshing after update

Posted on 2014-12-21
9
Medium Priority
?
155 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 51

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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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 51

Accepted Solution

by:
Gustav Brock earned 2000 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 51

Expert Comment

by:Gustav Brock
ID: 40512481
You are welcome!

/gustav
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 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