UI Threading in Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Reasonably new to Access, supporting a large project.

As the database gets larger, some of the queries are taking a LONG time, and
the UI is not updating.

I'm very experienced and familiar with worker/UI threads in VC++, and am
hoping I'm just missing how to get that same concept going in Access. My
users are telling me "I started an update, but it locked up so I killed the
process"... thereby causing more difficult issues. If I could get the UI to
update, at least they wouldn't think it had died!

Thanks in advance for any help

-Dave
[[email protected]]
 
My car will not start.....

not much for a mechanic to go on is it?

When you say the display is not updating, you might want to offer a bit more
info.

If you have a form, and update a text box, and then right after start a
query, then often, the event que will not update the display until
processing is done. The best solution in that case is to flush out the event
que. Simply put a doevents command in your code right before you run the
query.

You can also use timer event in the form, and that also will update
independent of the code running.

I have a sample progress bar in my "super easy" word merge example. You can
gab it...and try out the progress bar code. The progress bar will actually
continue to update even while you run a query. Other code samples in the
word merge use the progress bar...but not a timer event (just try a word
merge in the sample to see this).
 
Thanks Albert...

I think the fact that I just did a search for "doevents" on the entire
project and it wasn't found probably answers my question.

The "my car will not start" explanation is:

My predecessor has an "Import" button on a dialog. When that is pressed it
begins a very long chain of queries. Some of these are in functions, some are
inline, some take seconds, and some are very long. If, after pressing the
"Import" button, a user then brings up Outlook, or IE, or anything, do what
they intend to do and then click back onto Access, the UI does not update..
..they are left with what looks like Outlook on their screen, but it is only
the image left from their Outlook session.

Users not familiar with this will think Outlook is still active, since
that's what they're seeing. So they then try to click on Send/Receive or
something and of course it doesn't work, so they assume that their system has
crashed.

More familiar users will realize that Access is causing this, but will
assume Access has crashed, and go into task manager and kill the process.

I'm going to give your ideas a shot... sounds like the right thing to do.

I'm also going to look at your progress bar because considering the length
of some of these delays, that would be very useful.

Thanks... at least I found this group in the process of trying to find an
answer, and your site...

-Dave
 
Thanks... at least I found this group in
the process of trying to find an
answer, and your site...

Another good source of performance tips is MVP Tony Toews' site
http://www.granite.ab.ca/accsmstr.htm.

Your description might lead one to believe that some significant performance
improvement is possible with a better understanding of how Access "does
things". In general, the database engine is better at optimizing queries and
retrieving data than we are at using VBA code to retrieve the same data.

Larry Linson
Microsoft Access MVP
 
Back
Top