Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting crystal report through VB

Status
Not open for further replies.

lpjennifer

Programmer
May 26, 2004
2
US
Hi, I'm having a problem with my VB5/Seagate 7 program. It is very simple, a query is run against data in an Access db and the results are exported into a crystal report .RTF file. When there are records in recordset - everything runs seccessfully but when there are no records i get an "unable to access first record" error msg. This error only comes about when i run the .exe on an NT server.. if I run it on my PC (development) I have no issues.. with empty or not empty recordset. I believe my problem is in the setdatasource stmnt.. because the recordset i'm setting it to is empty when this stmnt runs.. does anyone know how i can just export the (already defined) "no data for this report" report?.. and one more thing.. would you know why it works ok, in any situation, when running on my dev. pc, but not the NT server! Thanks so much! Here is my code (after my if statement, if recordcount > 0):

Set oparam = rptsalesrosterChangeNONE.ParameterFields(1)
FromDate = Format(FromDate, "Short Date")
oparam.SetCurrentValue CStr(FromDate)rptsalesrosterChangeNONE.Database.SetDataSource rsReport
rptsalesrosterChangeNONE.Database.SetDataSource
Set grptReport = rptsalesrosterChangeNONE
grptReport.ExportOptions.FormatType = crEFTRichText
grptReport.ExportOptions.DestinationType = crEDTDiskFile
grptReport.ExportOptions.DiskFileName = strNewRpt
Call grptReport.Export(False)

Thanks again!
 
made a mistake.. my if statement is: If recordcount = 0 then

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top