janerussel
MIS
This is the second time I have posted this, maybe I didn't make myself clear, so I'll post again.<br><br>I have a long procedure. I import some large tables from an accounting database, then run a series of make table queries and insert the results into a new table and finally export those results for distribution.<br><br>I need to compact the database four times, even though I delete as many tables as I can along the way.<br><br>I have found two suggestions on compacting the database in code at this forum and none of them have worked for my needs. Below, I will explain why, and hopefully someone out there will have a suggestion that will work.<br><br>1. Use SendKeys - This works the first time it is called, but just skips over it everytime it is called thereafter. I wonder why?<br><br>Function compact_database()<br><br> SendKeys ("%(W1)"
<br> SendKeys ("%(TDC)"
<br><br>End Function<br><br>2. This code doesn't work, keep getting run time error 70, message, permission denied. <br><br> 'CompactDB<br> If Dir("d:\Access\Budget\Budgetbak.mdb"
<> "" Then<br> Kill "d:\Access\Budget\Budgetbak.mdb"<br> DBEngine.CompactDatabase <br> "d:\Access\Budget\Budgetbak.mdb", <br> "d:\Access\Budget\Budgetbak.mdb"<br><br> DoCmd.Hourglass False<br> MsgBox "Process Complete"<br><br>