Showing posts from April, 2015

VB 2010 MS Access Compact and Repair Database

MS Access 2003/2007/2010 Compact and Repair
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.
RequirementsMicrosoft Visual Basic .NETMicrosoft Jet and Replication Objects 2.1, 2.5, or 2.6 Library - For *.mdb file (200-2003)Microsoft.Office.interop.access.dao Assembly - For *.accdb file (2007)
Steps to build exampleOpen a new Visual Basic .NET console application.In the Solution Explorer window, right-click the References node and select Add Reference. If you are targeting ms access 2000-2003 (*.mdb) then, In the Add Reference dialog box, click the COM tab, and then…