DoEvents or DBEngine.Idle?

Tquasar

New member
Local time
Today, 05:54
Joined
May 22, 2018
Messages
2
In the past I have used DoEvents between queries in VBA to ensure each query was accomplished before the next.
But I have read that the DBEngine.Idle would be better suited in a multi-user environment. (Such as a Frontend on each user's computer linked to a Backend database on the server)

SO, which would be better?
1. Would either increase or decrease performance in a multi-user environment?
2. Is it always advisable to use DBEngine.Idle dbRefreshCache or just DBEngine.Idle?

Thanks in advance for any insight provided!!
 
In my experience, your best method is

Code:
DBEngine.Idle    dbRefreshCache

In MOST cases you will not see a difference in responsiveness between the two but IF your user's FE host machine has several other tasks running in the background at once, I believe you might see longer delays with DoEvents. But that has to be one VERY busy box to make the difference visible.

The difference is that DoEvents gives control over to the O/S and if your O/S task manager is busy, your system might have a lot of things to do. You must realize that ALL of Windows is event driven to some degree. Button clicks, program launches, disk I/O completions, screen painting, etc. - all are events for EVERY program you normally see running on a Windows box, whether we are talking web page, form-based control panels, or even command-line boxes where the events are keystrokes.

I believe the DBEngine.Idle does not quite so easily give control to the O/S - though if there is a voluntary I/O wait required internal to the operation (perhaps because the disk was busy or there is a network latency and you have to wait for the I/O to reach the Idle state), then the O/S gets to diddle around anyway. So it kind of depends on what is going on with your system.

To be perfectly honest, in the "distributed FE" environment that you described, the word "multi-user" has no effect because EITHER of those deferral options executes on the machine hosting the FE, which is a single-user system. The "multi-user" part is really only detectable on the machine hosting the BE file.
 
Two two are different.
DoEvents process any pending system events thereby causing your app to be responsive. while the other flush all any pending update to the table.
 
Thank you The_Doc_Man for the detailed response!
And arnelgp for the distinction.

So, in general, DoEvents will allow pending processes by the OS to be executed, while DBEngine.Idle will allow pending processes by MS Access to be executed.

Would it ever be appropriate to use both together since they are accomplishing different things and each has its usefulness? Maybe the DBEngine.Idle followed by the DoEvents?
 

Users who are viewing this thread

Back
Top Bottom