ukshir 0 Newbie Poster

For last couple of days I was going through this problem. Now I found the solution, so just thought that I would post here (Many of you might already know the solution, but still..... :) ).

I have a form having a Crystal report viewer control on it. After viewing the report and closing the form, I observed that the access database connection remained open (A .ldb file remained there in the data folder) even after closing the form. This .ldb file was causing problems while taking backup of my application with the error "Could not access .ldb file".

After searching forums, I could not get exact solution to this problem. Now I found one.

In the FormClosing event of my form that have the crystal report viewer, I added following code and it worked -

Dim myReport As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
        myReport = CrystalReportViewer1.ReportSource
        myReport.Dispose()

Now, no more .ldb file after closing the crystal report viewer :)