Compacting Access database using ADO

How can I compact and repair an Access database using ADO like I can do with DAO?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can't!

However you can add a reference to the Microsoft Jet & Replication engine to your product to compact your database using a statement like this:

Dim zz As JRO.JetEngine

Set zz = New JRO.JetEngine
zz.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = Source.mdb", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = Destination.mdb"

(If I'm not mistaking this engine ships with MDAC 2.1 or higher, SP3 for Visual Studio and with Access 2000)
Oh, and look in the MSDN library for more options (also for repairing). Look for the CompactDatabase method (for JRO that is)
Elad22Author Commented:
Thanks but I fidn another soultion:

Dim DBE As DBEngine
Set DBE = DBEngine
DBE.CompactDatabase "C:\1.mdb","C:\2.Mdb"
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Elad22Author Commented:
I solve it, thanks to all.
Not fair! { ;) }

Now you're still using DAO. (DBEngine is part of the DAO model)

Anyway, if this works for you then I guess it's okay.

see ya...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Elad22Author Commented:
I'm sorry.
Thanks a lot for helping!!!
you're welcome
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.