Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MS Access 2003 refresh form on popup form close

Posted on 2012-12-20
3
Medium Priority
?
713 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 49

Accepted Solution

by:
Dale Fye earned 2000 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 49

Expert Comment

by:Dale Fye
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

916 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