What is the best way to compact and/or repair a db via code? I am looking to do this both for the open DB (the one that is running the code) and for another one (for the data files). Thanks.
You can try these two lines of code...<br><br>Repair:<br> DBEngine.RepairDatabase "C:\your database name"<br><br>Compact :<br> DBENgine.CompactDatabase olddb:="C:\????", newdb:="C:\????"<br><br>Note: you can not repair or compact a databse that is these codes are being called from or an open database. Sorry, but it's a DAO limitation.<br><br>Hope this would help YOU... <p>Mohamed Aly<br><a href=mailto:samara_79@hotmail.com>samara_79@hotmail.com</a><br><a href= > </a><br>
To compact your front-end db while it is open, simply call the menu command from a command button. Use the code<br><br> SendKeys ("%(TDC)"<br><br>I use this from a switchboard button with no problems.<br><br><br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.