I am running VBA code that takes a while to execute and set up a popup form to notify the user to "Please wait." On this form I have two text boxes (txtUpdate1 and txtUpdate2).
I would like to periodically update the text in the boxes to provide status and/or other words to let the user know the program is still running.
I have tried to use the timer event on the popup form or the timer event on the original form (referencing the text boxes on the popup), neither of which worked.
It appears that the On Timer event does not run while my other procedure is running. Is there any way to fix this?
**Edit for Clarification:
This process is not a single loop or operation involving a set number of records or a set time. In short, a progress meter is not a realistic option for me. This is why I want to edit the text boxes every 5 seconds or so until the entire sub has completed.
Is there any way to get the On Timer event to work in this situation or to use some other method to periodically update the text boxes, based on the constraints above?
I believe you're out of luck. Both approaches suggested by Phil, and one is certainly very impressive, rely on being managed by the running code. IE. The code must break at certain points (Even if that is only to the extent of running DoEvents every now and again.) to allow the changes to be called for on the screen.
So, your options are : - To sew the notification code into your process code.
- Include DoEvents code in your process code as much as possible and have timer-based code that can determine what to show purely based on time, or other information that may be available to it.
Neither option's perfect but if you code consistently to use either it should enhance your projects as far as usability is concerned.
PS. I've not tested the second approach personally but your question caused me to think about it and I don't see a reason why it wouldn't work. Easy enough to test if you're interested, of course.
PPS. When running anything query-based it's not possible to break within a query itself. It would need to be done between queries.
5 1050
There are 2 methods
1) Use the built in Progress Meter; It is well documented using Access Help. The problem is it is an insignificant bar at the bottom of the screen.
I prefer to use a more colourful & informative version. See image below.
The progress meter is the small form at the top left, the larger form has instructions and allows you to "play" with the meter.
Phil
NeoPa 32,556
Expert Mod 16PB
I believe you're out of luck. Both approaches suggested by Phil, and one is certainly very impressive, rely on being managed by the running code. IE. The code must break at certain points (Even if that is only to the extent of running DoEvents every now and again.) to allow the changes to be called for on the screen.
So, your options are : - To sew the notification code into your process code.
- Include DoEvents code in your process code as much as possible and have timer-based code that can determine what to show purely based on time, or other information that may be available to it.
Neither option's perfect but if you code consistently to use either it should enhance your projects as far as usability is concerned.
PS. I've not tested the second approach personally but your question caused me to think about it and I don't see a reason why it wouldn't work. Easy enough to test if you're interested, of course.
PPS. When running anything query-based it's not possible to break within a query itself. It would need to be done between queries.
Thank you both for your replies. I've tried all those methods, and they do work for what they are meant to do. It's helpful just knowing that what I'm trying to do is not possible. I'll stop wasting time on it now. Thanks again!
NeoPa 32,556
Expert Mod 16PB
Hi Gnawoncents.
I guess you were trying to get it to reflect how far through it got on individual queries then yes?
Basically what you want to run is what they call a Worker Thread, which aren't available in Access. Multithreading: Creating Worker Threads
So like most people, it's easier to work within Access' boundaries and with Access' tools. I use the Status Bar. I'll provide you with a stripped down version of my code.
In this example there is a Large TextBox on a tab on the MainForm that captures every status entry. This allows me to fire off a process that my have a lot of messages and then that message history can be examined after getting coffee.
To set the Status: S etStatus("New Status")
To clear the status: SetStatus("")
To set the Status and clear the history: resetStatus("New Status")
To have a spinner in front of the text for those special messages you want the user to see, like the process is complete: setStatusBlink("All Done")
Example One
Example Two Sign in to post your reply or Sign up for a free account.
Similar topics
by: Perion |
last post by:
I have a simple form with, among other things, an ADODC data control (called
"Adodc1"). The ADO connection to the database tests fine but when I try to add
code to any of the Adodc1 control's event...
|
by: Roger |
last post by:
Hi All,
I need to call a text box click event programatically. How would I call the
following event procedure from another procedure within the same form:
Private Sub TextBox2_Click(ByVal sender...
|
by: Kathy Burke |
last post by:
Hi again,
I'm trying to run a sub from within another:
Public Sub txtScan_TextChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
txtScan.TextChanged
...
|
by: Ed |
last post by:
I would like to call another on_click procedure but fail...
e.g.
Sub try()
call button2_click() ' what should i put in (??, ??) since I don't know the
source and asg... in order to call button...
|
by: Jason |
last post by:
I have an ASP.NET application in which I would like to call my button click
event on the page load if certain criteria are met.
What is the correct syntax to be able to programmatically have my...
|
by: rokslide |
last post by:
Hi all,
I have a web application which (until a few weeks ago) was running fine.
Now, periodically, a stored procedure will stop responding and timeout when called via the web application. The...
|
by: kiransurisurisetty |
last post by:
Hi guys
i have created one procedure1 and i am trying to call the procedure1 into procedure2 ,and i got only one row result set from procedure1 but i am unable to get total out put of the...
|
by: grego9 |
last post by:
I simply want to close a message box that is called from another procedure. I don't want to alter the other procedure - I want the message box to appear but then the macro that I am writing to...
|
by: RojK |
last post by:
Hi,
I have a userform which has some command buttons and multiple listboxes in VBA.
I have a class module which handles events on the form, and a code in the form's initialization section which...
|
by: vishnu27 |
last post by:
how to call a stored procedure with no parameters into another procedure.
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |