[AccessD] Multithreading in VBA

Gustav Brock Gustav at cactus.dk
Wed May 10 11:44:21 CDT 2006


Hi Drew

So true, but it could have given you some options for, say, printing a report while updating a (non-related) recordset. 

I have not used it, but you could shell out to another Access instance which could perform some batch printing while your code leaves the shell command and let the user move on.

/gustav

>>> DWUTKA at marlow.com 10-05-2006 17:07:38 >>>
Actually, when dealing with Access, Multithreading would be a problem even
if VBA let you.  I've written multithreading VB 6 .exes.  It works great,
but you can't have more then one thread dealing with one .mdb at a time.  I
have a test program that just dumps data into a table in an .mdb.  One
thread will go until the database fills up.  However, the more threads you
have the faster they will crash (from write errors), and when the last
thread is closed the database is corrupted.  (Recoverable, but corrupted).
That is because the threads are being 'cycled' by the OS, and it doesn't
really care when, so JET could be checking for a lock in one thread, and
then the next thread to run may be setting a lock that the early thread just
set.  As you might guess, that will add up to trouble in a hurry.

Drew

-----Original Message-----
From: Gustav Brock [mailto:Gustav at cactus.dk] 
Sent: Wednesday, May 10, 2006 3:28 AM
To: accessd at databaseadvisors.com 
Subject: Re: [AccessD] Multithreading in VBA


Thanks Drew. 
It would have been nice, of course, and would it had been possible, I guess I would have read about it elsewhere but I haven't.

/gustav

>>> DWUTKA at marlow.com 09-05-2006 22:09 >>>
Unfortunately no.  Even in VB6, you cannot run multiple threads in debug mode.  Technically, when you run VBA, it's similar to debug mode.

Drew

-----Original Message-----
From: Gustav Brock [mailto:Gustav at cactus.dk] 
Sent: Tuesday, May 09, 2006 12:44 PM
To: accessd at databaseadvisors.com 
Subject: [AccessD] Multithreading in VBA


Hi all

I noticed this article about multithreading in VB6:

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=14479&lngWId=1

and wonder if that tip can be transferred to VBA (Access)?

/gustav





More information about the AccessD mailing list