I started thinking how I'm going to port part of an old design to Access, which allows for more than one process to run in a "workspace".
I'm not sure I've got the thinking correct on this, or if there is a way to avoid what I'm thinking might happen.
Trying to make it simple:
F1 = form 1
F2 = form 1 as a new instance or a completely different form
CM1 = class module for the form F1 which has procedures
CM2 = class module for the form F2 which has procedures
GV1 = global variable 1
SP1 = supporting procedure 1
I've got an array of global variables that I use for passing parameters between supporting procedures. This is because sometimes a sub is too complicated with multiple values to send or pass back (thus avoiding a function), or there may be a few different procedures that run before the final procedure needs the global variable that was calculated in a previous procedure.
In my old db system, if one started a new process (like a form), its workspace (and all variables) was completely isolated from the one that spawned it.
I'm wondering now what will happen in this example with Access:
F1 starts and and a procedure in CM1 uses SP1 to set GV1, F1 now waits for the user to do something.
F2 starts and and a procedure in CM2 also uses SP1 to set GV1, but it has a different value for GV1 than what was set for F1. F2 now waits for the user to do something.
F1 starts to run again, but in GV1 the value is what was needed for F2 and is invalid for F1.
Normally I'm used to a string of procedures running uninterrupted from start to finish without the possibility of another proces "getting in the way".
Is there a way around this in Access? In most cases I expect that a form's procedures will run from start to finish for most things, but it's possible that a waiting textbox entry could allow another procedure to run and contaminate global variables.
The routine I have is a lot more complicated than described above (with saving and restoring global variables when there is more than one level of SPn being called), but no matter how complicated it is, the same basic problem could arise. I use .Hwnd in forms, but this problem isn't limited to only forms, so the only way around it, that I can see is something like .Hwnd, for uniquely identifying any procedure that might run.