I am trying to compact a database using DAO.
Is this possible?
Thanks.
Dan.
Printable View
I am trying to compact a database using DAO.
Is this possible?
Thanks.
Dan.
DBEngine.CompactDatabase olddb, newdb, locale, options, password
Only the first line is necessary. It compacts the database name contained in sDBName to a new database named compact.bak.Code:DBEngine.CompactDatabase sDBName, "compact.bak"
Kill sDBName
Name "compact.bak" As sDBName
You can also repair the database with DBEngine.RepairDatabase sDBName
[Edited by MartinLiss on 08-01-2000 at 01:58 PM]
Martin you are one sexy man...
<heh> I feel another question coming...
My good friend John (JHausmann) got to you (harrumph) before I did. Does that mean that he's sexier than I am?
Not if it's your wife being asked...<heh>
........backup your database before the compact in case something goes really wrong:)
Jethro: The code sample I supplied compacts the database to a temporary database, so there's nothing to worry about.
Was just pointing out the requirement, have had people getting confused by the fact that the compact command doesn't compact the actual database but compacts to a backup version.
We generally then datestamp the original, copy it to an archive, and copy over the compact version. Of course this allows for reverting to the original db if the machine goes down mid-process or something.
Had some one here post they stuff their database while running compact from the Database Addin thing, they didn't understande the actual process involve. Probably due to expierance in one of the xbases which don't actually create a new compacted database.
My motto is better safe than sorry