So I have a process that basically takes a bunch of data from one table and stratifies it to another based on a gazillion business rules. The issue is that the performance starts off decently fast then comes to a grinding halt. I have found that while the process is running the database grows very quickly.
Stoping the code before it completes the process and manually compacting the database speeds things up immensely. The difference between a 2 hour process and a 39 minute process.
So what I want to do is periodically stop the code and compact the database, without having to manually click through repair and compact every time.
I was able to use the SendKeys "%(FMC)", False command in a macro that runs a function... to compact the data. So the code will run... The problem is that I can't seem to get the compact to work from my process function. the ALT+F doesn't open the MS Icon in the VBA debugger... so I am assuming I need to somehow tell Access to be in the database window... I tried to use the sendKeys for alt+F11 i.e., "%{F11}", but that just locked up on me when I attempted to just run the SendKeys and not even put it in my biggger process function.
What I'd like to do is use an autoexec macro and have the code run every time the database opens... get to the point of the compact and then compact... when it opens again the autoexec macro will kick off and then I'll have a trigger in a table to kill the process when it's all done.
SO does anyone know how I can compact the database from within the a function I am running?
Thanks,
Gary
Stoping the code before it completes the process and manually compacting the database speeds things up immensely. The difference between a 2 hour process and a 39 minute process.
So what I want to do is periodically stop the code and compact the database, without having to manually click through repair and compact every time.
I was able to use the SendKeys "%(FMC)", False command in a macro that runs a function... to compact the data. So the code will run... The problem is that I can't seem to get the compact to work from my process function. the ALT+F doesn't open the MS Icon in the VBA debugger... so I am assuming I need to somehow tell Access to be in the database window... I tried to use the sendKeys for alt+F11 i.e., "%{F11}", but that just locked up on me when I attempted to just run the SendKeys and not even put it in my biggger process function.
What I'd like to do is use an autoexec macro and have the code run every time the database opens... get to the point of the compact and then compact... when it opens again the autoexec macro will kick off and then I'll have a trigger in a table to kill the process when it's all done.
SO does anyone know how I can compact the database from within the a function I am running?
Thanks,
Gary
Last edited: