Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1135
  • Last Modified:

Crystal Report using Adobe Reader to view under VB6 development

Hi all,

I am using Visual Basic 6. And my report is using Crystal Report 8.5 to develope. I am doing the Windows application using VB6.
On my windows application, when I click on the preview button, I will use the below coding to export my crystal report to PDF file, and use Adobe Reader to open the PDF file.
                    Private Sub PrintReport()
                         Dim crReport As New cr_po

                         crReport.ExportOptions.ApplicationFileName = "C:\Purchase_Order.pdf"
                         crReport.ExportOptions.DestinationType = crEDTApplication
                         crReport.ExportOptions.DiskFileName = "C:\Purchase_Order.pdf"
                         crReport.ExportOptions.PDFExportAllPages = True
                         crReport.ExportOptions.FormatType = crEFTPortableDocFormat
                         crReport.Export False
                    End Sub

When the report being view in the adobe reader. Then I go to my windows application and click the "Preview" button again, it will having an error by saying that
                                          " Run-time error '-2147206452 (80043acc)' "
                                          The file is use by another application.

I know this is because of the PDF file is being open, my another PDF file is creating and using the same file name. I just want to know is there any other way to view the Crystal Report file in PDF?

Thanks & Best regards.
  • 2
1 Solution
What happens if you comment out or delete this line
crReport.ExportOptions.DiskFileName = "C:\Purchase_Order.pdf"

runbirdAuthor Commented:
Even though I comment out this line >> crReport.ExportOptions.DiskFileName = "C:\Purchase_Order.pdf"
I am still getting the same error. Because when one pdf file is browsing, another pdf file will not be able to export with the same file name.

What if you modified the filename to include a global variable

Something like this
FileNameModifier = FileNameModifier + 1
crReport.ExportOptions.DiskFileName = "C:\Purchase_Order_" & CStr(FileNameModifier,0) & ".pdf"


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now