PDA

Click to See Complete Forum and Search --> : CompactDatabase and ADO


Aug 28th, 2000, 08:45 AM
Using VB6 and Access 2000

When you want to compact a database and your using ADO,
do you still use:-

DBEngine.CompactDatabase "olddb", "newDB"

In the VB docs it only ever references DAO when you
look up CompactDatabase

Is there another way?

Thanks,

SeanR

Clunietp
Aug 28th, 2000, 09:35 PM
compact a database using ADO

'uses ADO 2.x and Microsoft Jet and Replication Objects 2.x

'declare variables
Dim objJRO As JRO.JetEngine
Dim strConnSource As String
Dim strConnDestination As String

'set connection string info
strConnSource = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Nwind2k.mdb"
strConnDestination = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\NewDb.mdb"

'instantiate object
Set objJRO = New JRO.JetEngine

'compact database from source to destination
objJRO.CompactDatabase strConnSource, strConnDestination

'release objects
Set objJRO = Nothing

Aug 29th, 2000, 03:44 AM
Thanks for your help ClientP

Clunietp
Aug 29th, 2000, 10:25 AM
ClientP?

Close enough.... :)

Aug 30th, 2000, 03:56 AM
Sorry abount that ClunietP.

It should teach me to look more closely and not
just scan.

SeanR