Click here to Skip to main content
15,904,348 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've been facing issues with Compact & Repair being called from vb.NEt application.
No errors reported, but it doesn't fix the problem.
Whereas if I open the same mdb file in MSAccess and repair it, it works!

What I have tried:

Below is the code I tried:

Method1:
 Dim JRO As New JRO.JetEngine

                JRO.CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source= " & "C:\tempDB.mdb",
            "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & mdwfilename & ";Jet OLEDB:Engine Type=5")

Method2:
Dim app As New Microsoft.Office.Interop.Access.Application

Dim tempFile As String = "C:\tempDB.mdb"
app.CompactRepair(mdwfilename, tempFile, False)
app.Visible = False

Dim temp As FileInfo = New FileInfo(tempFile)
temp.CopyTo(mdwfilename, True)
temp.Delete()
Posted
Updated 15-May-19 4:45am

1 solution

Try a "sub-folder"; some operations cannot be carried out in the "root folder" of the boot disk.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900