Solved

MS Access 2003 refresh form on popup form close

Posted on 2012-12-20
3
696 Views
Last Modified: 2012-12-21
My attacjed code looks right.

It opens my popup which I ender some data etc and then close.

However...the underlying form doesn't get refreshed.

Private Sub btnSubmit_Click()
    DoCmd.OpenForm "ClientVisitsPopUp", WindowMode:=acDialog, OpenArgs:=Me.lvClientsNearby.Column(2) & "|" & gbl_VisitClientID & "|" & gbl_NearbyClientID & "|" & Me.gbl_VisitID
    Me.refresh
End Sub

Open in new window

0
Comment
Question by:lrbrister
  • 2
3 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 38711131
Given your code, I assume you have a button on the "ClientVisitsPopUp" that writes the data to your underlying table, and then closes the form (or hides) it.

However, if you are adding to the table, you need to use:

me.Requery

instead of:

me.Refresh

The Refresh method will update data that has been changed in the forms current recordset, but will not display additions to the recordset that have been since the form was opened.  In order to reflect changes due to additions or deletions, you must use the Requery method.
0
 

Author Closing Comment

by:lrbrister
ID: 38713802
Thanks
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38713861
You might also want to capture the primary key from the record you added, and after the Requery method, use the FindFirst method to move the record pointer to that record.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem: Word 2016 cannot import a .vsdx created with Visio 2013 6 51
VBA modules import 4 56
UK Date format in MS Access 4 21
ERROR 3113 MODULEID NOT UPDATABLE 8 18
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

840 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