Solved

Access 2010 - popup form to run routine on open

Posted on 2013-05-22
2
1,049 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
ID: 39189498
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
ID: 39189786
great.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

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…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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 …

770 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