Article ID: 306287 - Last Review: May 16, 2007 - Revision: 2.3 How to compact a Microsoft Access database by using Visual Basic .NET
This article was previously published under Q306287 On This PageSUMMARY
Neither ActiveX Data Objects (ADO) nor ADO .NET provide the means to compact or repair Microsoft Access databases. However, you can accomplish this task by using the Microsoft Jet OLE DB Provider and Replication Objects (JRO) that was introduced with Microsoft Data Access Components (MDAC) version 2.1. ADO .NET allows the use of COM-based object libraries through the Interop layer. This article demonstrates how to compact an Access database by using Visual Basic .NET. Requirements
Steps to build example
PitfallsIn order to compact a database, the Jet Database Engine requires exclusive access to the database file. Attempting to compact a database file that is currently in use will result in an exception. This exception can be caught using a Try...Catch structure.REFERENCES
For more details about the .NET Framework and the COM Interop layer, see:
Exposing COM Components to the .NET Framework
For more information about using ADO and JRO to compact Access Databases, click the following article number to view the article in the Microsoft Knowledge Base:
http://msdn2.microsoft.com/en-us/library/z6tx9dw3(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/z6tx9dw3(vs.71).aspx) 230501
(http://support.microsoft.com/kb/230501/
)
How to compact Microsoft Access database via ADO
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations
|





















Back to the top