Solved

Access 2010 - popup form to run routine on open

Posted on 2013-05-22
2
1,025 Views
Last Modified: 2013-05-22
I have a main menu form with an option to 'update search database' that opens a popup form with a series of labels with tick boxes beside each label, plus a CANCEL button. Each label represents an update procedure that gets ticked as it is done.  Eg. update client, update contacts, update notes, update jobs, etc.

At the end the popup form closes automatically.

I want the update series to run automatically on popup open, but I also want pressing CANCEL to stop process and  close popup.

To get the update code to run automatically I tried calling it from the main form, after the docmo.open form.

So, instead of using:
docmd.openform "frmExtractData",,,,,AcDialog
I used
    DoCmd.OpenForm "frmExtractData"  
    Call Form_frmExtractData.lblGo_Click

This works fine unless the user wants to CANCEL  during update procedure.  The update code keeps running!

Any ideas of how I can get the functionality I want?  TO recap, the popup needs to start update code automatically on form open, and close form when finished, but also allow user to CANCEL.

If I put the call to the update routine in the form open, load, activate, render, current event the update code runs, but the popup form never appears. The purpose of the popup form is to give the user an idea of where in the process it is, by seeing a tick against each label as it works through the list.
0
Comment
Question by:MonkeyPie
2 Comments
 
LVL 12

Accepted Solution

by:
pdebaets earned 500 total points
Comment Utility
Set the pop-up form TimerInterval property to 1000, then create an OnTimer event procedure. As the first line of code in the OnTimer event procedure put

TimerInterval = 0

This will cause the OnTimer code to run one second after the pop-up form opens (and it won't continuously execute because the timer gets turned off).

In the OnTimer code (after the "TimerInterval = 0"), you can run your updates, and tick your checkboxes while checking for the "Cancel" condition. You could have the Cancel button set the value of a hidden checkbox. Your OnTimer code could continuously check the value of that check box to see if processing should continue or stop.
0
 

Author Closing Comment

by:MonkeyPie
Comment Utility
great.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now