My overall goal is to programmatically import objects (modules and a form) that are called from the autoexec function (that is called from the autoexec macro). Unfortunately, since they are called from the autoexec function, then once these are loaded into memory, you can't bring in new copies, or you get a duplicate definition error.
We send users a database that has just their new objects to update their application, and we need to run code to import these objects and remove the old copies. We also have a security.mdw, as these databases are locked.
I created an external vb app to close the open forms, but I didn't realize that the autoexec function is still running, so it still locks all objects it has loaded in memory. My external vb app calls a macro that just calls a function. The vb app closes all open forms in the main db, and I thought this would unload the autoexec code from memory, but it doesn't, so I'm ending up calling my function with the autoexec code still loaded, so I will still get the duplicate definition error if I try to import the objects.
This app was started before I got here. The autoexec macro does nothing but call a function called AutoExecStart. That function runs all the code. When I look at the call stack, I see that the autoexecstart function is running, it has called my external vb app, which has then called the macro/function I want to run to import the objects. I thought that since the vb app closed forms and then called a macro/function, that the autoexecstart code would not be in the same stack and could therefore be unloaded, but that doesn't seem to be the case. What have I missed? I have DoEvents sprinkled liberally about to try to get things to finish up what they are doing and unload.
Is there a way I can start up access without running the autoexec macro? I could close the app and restart it and work with it if I could get it to not run the autoexec. I have not been able to find a way to programmatically open the db WITH SECURITY and be able to get to the objects, not just data. I can use DAO/ADO if I just wanted data, but I have to open 2 db's (the main one and the update one) and get objects transferred between them. I could open the main db with security, but not get a handle to it and get the objects, unless I run the autoexec which then has loaded the objects I'm trying to replace.
If I could make that any more confusing, I'd have a career in politics!
Helpful suggestions welcome and very much appreciated.
Ahliana
Argue for your limitations and, sure enough, they're yours! - Richard Bach
We send users a database that has just their new objects to update their application, and we need to run code to import these objects and remove the old copies. We also have a security.mdw, as these databases are locked.
I created an external vb app to close the open forms, but I didn't realize that the autoexec function is still running, so it still locks all objects it has loaded in memory. My external vb app calls a macro that just calls a function. The vb app closes all open forms in the main db, and I thought this would unload the autoexec code from memory, but it doesn't, so I'm ending up calling my function with the autoexec code still loaded, so I will still get the duplicate definition error if I try to import the objects.
This app was started before I got here. The autoexec macro does nothing but call a function called AutoExecStart. That function runs all the code. When I look at the call stack, I see that the autoexecstart function is running, it has called my external vb app, which has then called the macro/function I want to run to import the objects. I thought that since the vb app closed forms and then called a macro/function, that the autoexecstart code would not be in the same stack and could therefore be unloaded, but that doesn't seem to be the case. What have I missed? I have DoEvents sprinkled liberally about to try to get things to finish up what they are doing and unload.
Is there a way I can start up access without running the autoexec macro? I could close the app and restart it and work with it if I could get it to not run the autoexec. I have not been able to find a way to programmatically open the db WITH SECURITY and be able to get to the objects, not just data. I can use DAO/ADO if I just wanted data, but I have to open 2 db's (the main one and the update one) and get objects transferred between them. I could open the main db with security, but not get a handle to it and get the objects, unless I run the autoexec which then has loaded the objects I'm trying to replace.
If I could make that any more confusing, I'd have a career in politics!
Helpful suggestions welcome and very much appreciated.
Ahliana
Argue for your limitations and, sure enough, they're yours! - Richard Bach