Solved

Access 2010 - popup form to run routine on open

Posted on 2013-05-22
2
1,067 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 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

733 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