Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Replacement for DoEvents

Posted on 2012-03-15
7
Medium Priority
?
306 Views
Last Modified: 2012-04-11
I have a form (well several actually) that perform specific functions.  When running it updates the forms caption to tell the user what is happening.  

To avoid the "Not responding" message at the top of the form (whilst the process is running), I have been using the DoEvents command.  However, this can cause other knock on effects (especially across slower networks).

Is there another command that allows the form message to be updated and clears the "Not responding" message?

Thanks as always
0
Comment
Question by:Andy Brown
[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
  • 3
  • 3
7 Comments
 
LVL 15

Expert Comment

by:Simon Ball
ID: 37723859
It depends what you are updating the form for, if its just to report progress to the user there's the option of using the status bar to update, just like access does when running a big query...

http://msdn.microsoft.com/en-us/library/aa221609(v=office.11).aspx

http://codevba.com/fragments/help.htm?http://codevba.com/fragments/Access_StatusBar.htm

Otherwise you can form.refresh or repaint...but i am not sure the specifics on those as i have tried to use them in the past and some actions do not seem to activate them, as you seem to be finding.
0
 

Author Comment

by:Andy Brown
ID: 37723868
Thanks for your quck response.

I can't use the status bar as it is hidden on this particular app (need as much screen space as possible).

The biggest pain is the "Not responding" message and I don't think Refresh/Repaint clears that - but i'll check.
0
 
LVL 15

Expert Comment

by:Simon Ball
ID: 37723876
are you running big queries or performing lots of processing in sql?

might be worth writing a test app to see if VBA provides natural breaks, such as calling sub procedures for each step, and having actions perform changes to the form in between calling each sub / function.

Or have your code open a seperate form which just has a label saying "processing.... please wait, this can take up to X minutes" and then close the form in the other code when the big piece of work has been done.
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:Andy Brown
ID: 37724227
It's all in on sub routine, so I'll try splitting things out and see what happens.

Thanks again.
0
 
LVL 15

Accepted Solution

by:
Simon Ball earned 2000 total points
ID: 37724277
could try writing a sub which updates the form, shows info, etc, and call it inbetween other steps

call dosomework1
call updateform(1)
call dosomework2
call updateform(2)

etc
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37724990
Yeah, the "Not Responding" message is a bit confusing...

Most people see it and assume the app is locked, or it crashed...
So they "Ctrl-Alt-Del" out of the program.

Many times it just means that the app is doing something that is just taking a long time.

I fear that there may not be that much you can do to avoid this, that won't cause even more issues under other circumstances.

For example, you can use: Docmd.Echo False
To simply "freeze" the screen
(Then obviously turn it back on with Docmd.Echo True)

But this will cause confusion if an error occurs and your error handier does not turn Echo back on...


DoEvents is similar to Sendkeys in that it is a "Brute Force" way of doing something.
With each new release of a MS Programming platform, they always threaten to deprecate it.


Always go back to the beginning, ...instead of focusing on "working around" this situation, ...How about trying to eliminate it in the first place?
;-)

Are you 100% sure that these "specific functions" are as streamlined and efficient as possible?
Running recordsets (and/or not closing them properly) where SQL could be used
Poor Indexing
Poor Variable declarations
Inefficient Loops
Doing things for "All" records, when it is only needed for certain records.
Complex AND/OR Logic
Using Wildcards
Using too many Aggregate functions.
...even having an un-normalized table design...
...etc

You have not posted any details on these "specific functions."
...Perhaps you could enlighten us...?

JeffCoachman
0
 

Author Closing Comment

by:Andy Brown
ID: 37832179
Sorry for the delay in comming back to you - that did the trick.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
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…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

722 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