synr or asyn?

H

hzgt9b

I have two mdbs, call them mdb1 and mdb2. mdb1 has some modele code that I
want to execute via events triggered through a GUI interface in mdb2. From
reading other threads on this board, the only way this can be done is to make
the code in mdb1 a Function. Question 1 - Is this true?

Question 2 - when I call the code in mdb1 from mdb2, will it sun
asynchronously or synchronously?

Thanks in advance for your thoughts
 
M

Michel Walsh

Hi,



Question 2: VBA has only one single thread of execution. You can mimic time
slicing with DoEvents within it, but that is all you got. Sure, some VBA
function can perform asynch operation (like opening a recordset), but
basically, your VBA code itself will run synchronously. You can see the
second mdb as a dll to your main application, the first mdb. In fact, you
can add mdb2 as reference inside mdb1.


Question 1: For an event? last time I checked, even in one database
involved, only functions are allowed, since they have to match the signature
of the event, or I misread your question?



Hoping it may help,
Vanderghast, Access MVP
 
H

hzgt9b

Thanks for the reply,

Q1... I wanted to be able to call a subroutine in mdb1 from mdb2 - but I
don't think that's possible. Further, I don't want to have to add a reference
in mdb2 for mdb1 b/c all the code is dynamic. (Though I suppose that I could
automate the incorportation of the foreign db reference.)

Q2... thanks - I was hoping it to be synchronous and suspected as such - a
simple test will tell the tale.
 
D

David C. Holley

As to Q1, sounds like you need to place the SUBs into a library
database. Its been quite sometime since I've dealt with libraries so I
can't tell you much other than they are a means by which you can reuse
SUBs & FUNCTIONs across multiple dbs. The Access Wizards are all
contained in library databases.
 
H

hzgt9b

That's an idea. The problem is that the code in MDB1 can't be changed - so I
just want to be able to open the mdb1 and run a SUB contained in it...

Regardless, thanks for the feedback.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top