CodeItBetter Programming Another VB Programming Blog

How to compact an Access Database from VB

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'Database - How to compact an Access Database from VB

'Add reference to DAO (Project -> References, select the Microsoft DAO 3.6 (or 3.51) Object Library)

'If you get "Unrecognized Database format" error message:

'If you using database that made in Access 2000 and you don't have Microsoft DAO 3.6 Object Library reference,
'click on browse, and select the file C:\Program Files\Common Files\Microsoft Shared\Dao\dao360.dll
'(If you have Access 2000 installed in your computer you have this file.)

'This will add Microsoft DAO 3.6 Object Library reference to your project.

Private Sub Main()
    DBEngine.CompactDatabase "C:\Temp\Test.mdb", "C:\Temp\Test1.mdb"
End Sub
Filed under: Database Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.