lanier3532
asked on
Crystal Reports XI exporting blank .PDF's
Hello Experts,
i have a vb.net application which uses Crystal Reports XI to automatically create a .pdf file and then email it a list of users.
90% of the time, it works fine. Sometimes the .pdf is empty of data. It has the labels, boxes, etc., but no data. Every time i run the app in debug mode, perfect. if you trigger the report to run again, you may get data. i can't reproduce the problem, it is sporadic.
i've tried to put timers in to delay code execution hoping that Crystal could "catch up" when querying the database (Microsoft Access database), but no measurable improvement.
here is my code:
lblStatus.Text = "Loading rpt...2 sec"
Application.DoEvents()
Sleep(2000)
rpt = New ReportDocument
rpt.Load(gPath & "ApprovedOrder.rpt")
rpt.Refresh()
lblStatus.Text = "Set parameters, logon...2 sec"
Application.DoEvents()
Sleep(2000)
rpt.RecordSelectionFormula = " {Orders.ProjectNumber}='" & rs.Fields("ProjectNumber") .Value & "'"
rpt.SetParameterValue("@Sh ippingLabe l", ShippingLabel)
rpt.SetParameterValue("@En teredBy", EnteredBy)
logOnToServer(rpt)
lblStatus.Text = "Exporting...5 sec"
Application.DoEvents()
Sleep(5000)
rpt.ExportToDisk(ExportFor matType.Po rtableDocF ormat, gPath & "Reports\" & ProjectNumber & ".pdf")
lblStatus.Text = "Closing...2 sec"
Application.DoEvents()
Sleep(5000)
'rpt.PrintToPrinter(1, False, 1, 1)
rpt.Close()
rpt.Dispose()
rpt = Nothing
lblStatus.Text = "Emailing...2 sec"
Application.DoEvents()
Sleep(2000)
i have a vb.net application which uses Crystal Reports XI to automatically create a .pdf file and then email it a list of users.
90% of the time, it works fine. Sometimes the .pdf is empty of data. It has the labels, boxes, etc., but no data. Every time i run the app in debug mode, perfect. if you trigger the report to run again, you may get data. i can't reproduce the problem, it is sporadic.
i've tried to put timers in to delay code execution hoping that Crystal could "catch up" when querying the database (Microsoft Access database), but no measurable improvement.
here is my code:
lblStatus.Text = "Loading rpt...2 sec"
Application.DoEvents()
Sleep(2000)
rpt = New ReportDocument
rpt.Load(gPath & "ApprovedOrder.rpt")
rpt.Refresh()
lblStatus.Text = "Set parameters, logon...2 sec"
Application.DoEvents()
Sleep(2000)
rpt.RecordSelectionFormula
rpt.SetParameterValue("@Sh
rpt.SetParameterValue("@En
logOnToServer(rpt)
lblStatus.Text = "Exporting...5 sec"
Application.DoEvents()
Sleep(5000)
rpt.ExportToDisk(ExportFor
lblStatus.Text = "Closing...2 sec"
Application.DoEvents()
Sleep(5000)
'rpt.PrintToPrinter(1, False, 1, 1)
rpt.Close()
rpt.Dispose()
rpt = Nothing
lblStatus.Text = "Emailing...2 sec"
Application.DoEvents()
Sleep(2000)
ASKER
that won't work. It is running on a computer with no email client. My software is using a 3rd party control to send this email and others...
I don't know then.
mlmcc
mlmcc
I believe that this is another example of a problem with the "pull" method that Crystal uses. I am finding all kinds of questions that revolve around the problems that Crystal has with pulling data from the source. I like to control how the data is retrieved, and then "push" it to the report. Then, I don't have to deal with login problems, and parameter problems, et. al.
ASKER
Can you elaborate, please? Thanks.
Attached is a PDF file that describes how I use the push method.
Crystal-Reports-Tutorial.pdf
Crystal-Reports-Tutorial.pdf
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i've implemented the solution suggested, but have limited testing. So far, however, things are looking good. We'll see how it works over the next couple of weeks. Thanks!
mlmcc