I have a database app where on a button click, I export the current record to crystal report which in turns converts it to a PDF file. Upon application startup, I export one record into PDF just fine but when I move ahead to the next record and I click the export button, the new PDF file that was exported is now blank. If I restart the app, I can then export the one record again but any subsequent record will export to PDF as a blank PDF file.
To sum up:
I can export one record once using the below code snippet but when I try it for a second time on another record, I get a blank PDF file (only the crystal report formatting is in the PDF).
[code]
cryRpt.RecordSelectionFormula = "{PRREQUESTS.ID} = " & lblRequestNum.Text
[/code]
*this above line of code does what it should but it doesn't do it everytime....only the first time.
Here is all the code for the button click event for the export:
[code]
Private Sub btnSubmitNewReq_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmitNewReq.Click
cryRpt.Load("H:\programs\PR_Requests\PR_Requests\rptPRRequests.rpt")
Try
cryRpt.RecordSelectionFormula = "{PRREQUESTS.ID} = " & lblRequestNum.Text
Dim CrExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions()
Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions()
CrDiskFileDestinationOptions.DiskFileName = "H:\PR_Request_" & lblRequestNum.Text & ".pdf"
CrExportOptions = cryRpt.ExportOptions
With CrExportOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = CrFormatTypeOptions
End With
cryRpt.Export()
Catch ex As System.Exception
MsgBox(ex.ToString)
End Try
End Sub
[/code]
Thanks for any help!!!
Jason
!--removed tag-->
Enter your message below
Sign in or Join us (it's free).