[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Access 2010 - popup form to run routine on open

Posted on 2013-05-22
2
Medium Priority
?
1,090 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

650 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