Library code snippets
Compact and repair databases in ADO
In a previous tip (Compact and repair Jet databases with DAO), we showed
you how to compact and repair a database with DAO. However, if you're
using ADO, you can also compact and repair Access databases using Jet and
Replication Objects (JRO).
To take advantage of JRO's CompactDatabase method, which will also repair
the database, set a reference the JRO library, Microsoft Jet And
Replication Objects 2.1 Library. Next, declare and set a JetEngine object
variable, like soDim JRO As JRO.JetEngine
Set JRO = New JRO.JetEngine
JRO.CompactDatabase _
"Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\myData1.mdb", _
"Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\myDataNewName.mdb"_
& ";Jet OLEDB:Engine Type=4"
This command follows similar syntax as DAO's CompactDatabase method-you
must provide the old database name and the new database name. In the
case of JRO, however, you must also provide a valid connection string,
as well as indicate the type of Jet engine to compact the database as.
We used 4 to create a Jet Version 3.x database suitable for Access 97
users. If you work with Access 2000 use the value 5 to create a Jet
Version 4.x database.
Related articles
Related discussion
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
-
Can you describe Above simple VB6 code?
by pramodmca09 (0 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
This thread is for discussions of Compact and repair databases in ADO.