?
Solved

Access 2010 - popup form to run routine on open

Posted on 2013-05-22
2
Medium Priority
?
1,082 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
[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
2 Comments
 
LVL 12

Accepted Solution

by:
pdebaets earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

765 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