>
| Part | Description |
| olddb | A string expression that identifies an existing, closed database. It can be a full path and filename, such as "C:\MYDB.mdb". If the filename has an extension, you must specify it. If your network supports it, you can also specify a network path, such as "\\MYSERVER\MYSHARE\MYDIR\MYDB.mdb". |
| newdb | A string expression that is the full path of the compacted database that you're creating. You can also specify a network path as with olddb. You can't use the newdb argument to specify the same database file as olddb. |
| locale | A string expression used to specify collating order for creating newdb, as specified in Settings. If you omit this argument, the locale of newdb is the same as olddb. |
| options | An integer that indicates one or more options, as specified in Settings. You can combine options by summing the corresponding constants. |
| password | An optional string argument containing a password, if the database is password protected. The string ";pwd=" must precede the actual password. |
| Constant | Collating order |
| dbLangGeneral | English, German, French, Portuguese, Italian, and Modern Spanish |
| dbLangArabic | Arabic |
| dbLangCyrillic | Russian |
| dbLangCzech | Czech |
| dbLangDutch | Dutch |
| dbLangGreek | Greek |
| dbLangHebrew | Hebrew |
| dbLangHungarian | Hungarian |
| dbLangIcelandic | Icelandic |
| dbLangNordic | Nordic languages (Microsoft Jet database engine version 1.0 only) |
| dbLangNorwdan | Norwegian and Danish |
| Constant | Collating order |
| dbLangPolish | Polish |
| dbLangSpanish | Traditional Spanish |
| dbLangSwedfin | Swedish and Finnish |
| dbLangTurkish | Turkish |
| Constant | Description |
| dbEncrypt | Encrypt the database while compacting. |
| dbDecrypt | Decrypt the database while compacting. |
| Constant | Description |
| dbVersion10 | Creates a database that uses the Microsoft Jet database engine version 1.0 while compacting. |
| dbVersion11 | Creates a database that uses the Jet database engine version 1.1 while compacting. |
| dbVersion20 | Creates a database that uses the Jet database engine version 2.0 while compacting. |
| dbVersion30 | Creates a database that uses the Jet database engine version 3.0 while compacting. |
DBEngine.CompactDatabase "C:\Biblio.mdb","C:\BibNew.mdb","",dbEncrypt ... Kill "C:\Biblio.BAK" Name "C:\Biblio.mdb" As "C:\BIBLIO.BAK" Name "C:\BibNew.mdb" As "C:\Biblio.mdb"This example copies a database named Northwind.mdb and keeps a new, compacted copy named COPY.NEW. The new database is encrypted.
DBEngine.CompactDatabase "C:\Northwind.mdb", "C:\Copy.NEW","",dbEncrypt