• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Compacting Access database using ADO

How can I compact and repair an Access database using ADO like I can do with DAO?
0
Elad22
Asked:
Elad22
  • 4
  • 3
1 Solution
 
p_biggelaarCommented:
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)
0
 
p_biggelaarCommented:
Oh, and look in the MSDN library for more options (also for repairing). Look for the CompactDatabase method (for JRO that is)
0
 
Elad22Author Commented:
Thanks but I fidn another soultion:

Dim DBE As DBEngine
   
Set DBE = DBEngine
DBE.CompactDatabase "C:\1.mdb","C:\2.Mdb"
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Elad22Author Commented:
I solve it, thanks to all.
0
 
p_biggelaarCommented:
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...
0
 
Elad22Author Commented:
I'm sorry.
Thanks a lot for helping!!!
0
 
p_biggelaarCommented:
you're welcome
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now