Multithreading? Or something else, perhaps?

tkpstock

Cubicle Warrior
Local time
Yesterday, 19:54
Joined
Feb 25, 2005
Messages
206
I am pulling data out of a Sybase database (which is taking a couple of minutes). As I do this, I pop-up a custom form that tells the user to "Please Wait" (I use this form to show progress in many applications - it has custom properties, etc). The problem is that while the computer is attempting to access the Sybase, all other actions shut down - I can't show any progress, change any displays, etc. while that code is running. When I use the Timer event, even that event doesn't fire while the code is running (I set a label to increment every second during the query and repainted the form each time, but still it stopped during code execution).

Is there a way around this? Is there any true multi-threading in Access?
 
Question: Does everything else in Windows work, just not Access, or is Windows prety much at a stand still also?
 
Nope - Windows is fine - it's just Access that is at a stand-still.
 
G’day Tom.

Is there any true multi-threading in Access?

No, not with a single instance of Access.

But I just did a very little testing and it seems to work this way…

I created an Access97 database, called db1.mdb, with a tight loop: -

Code:
Public Function AutoExec()
    
    While True
        
    Wend

End Function
And called it from an AutoExec macro. Naturally it locked up Access97 and could only be stopped with Control/Break.

Then I created an Access2000 database and opened db1.mdb with: -

Code:
Sub Test()

    Shell "C:\Program Files\Microsoft Office\Office\msaccess.exe c:\db1.mdb"

End Sub
The Shell command, in Access2000, used Access97 to run db1.mdb asynchronously. The timer event in Access2000 continued to run, on a one-second basis, even though Task Manager showed 100% CPU usage. I could also move around in Access2000 without problems.

Now since the timer is functioning in Access2000 you could use that to test when Access97 has finished and, perhaps, have any tables created in Access97 linked to Access2000.

So, if you have two different versions of Access on your machine, you may be able to use them that way… but it is not a recommendation.

Hope that helps. (All care but no responsibility taken. :D )

Regards,
Chris.
 
Tom.

The ODBC driver defaults to a synchronous (waiting) mode. The
Connection.Execute can be passed a command and a flag to indicate
asynchronous transfer mode.

It will be up to you to determine when the data transfer is complete.

I'll look for an example.

Wayne
 
The table I'm querying from is a linked table (linked in Access to Exchange Recipients table). This linked table is in the local database - how can I open that using ODBCDirect? Better yet, how can I connect to the Exchange server directly using ODBC? I have no clue on that one...

Apparently ODBC is the only way to do this asynchronously.
 

Users who are viewing this thread

Back
Top Bottom