Link to home
Start Free TrialLog in
Avatar of LangstonT
LangstonT

asked on

Problem with exprtorting a crystal report through VB

Hello,

This is what I'm trying to do and what I have accomplished so far. I've created a crystal report v8.5 that uses tables from SQL. I then have VB6 code that exports the report out to PDF format. This works without a hitch. I now need to also have the report pull information from a MSAccess 2000 database. I was able to add all the needed linking and the report comes up perfectly when I preview it.

The problem is this - when I use my VB code that was previously working to try and export the report nothing gets exported. The exporting records dialogs pops up like normal but the record count doesn't move and it disapears quickly. Below I have listed the VB code. I wasn't sure if this should be posted in this section or in a VB section.

CrystalReportPath = "c:\"


ReportToWebPath = "\\saveatree\routerwatch\"
ReportToWebReport = ReportToWebPath + "Electronic Log.pdf"

Report1 = CrystalReportPath + "ELog.rpt"


Rem **** Export to Disk ****
Result = PEOpenEngine()
ReportJob = PEOpenPrintJob(Report1 & vbNullChar)
Result = PEDiscardSavedData(ReportJob)
Result = crPEExportToDisk(ReportJob, ReportToWebReport & vbNullChar, "crxf_pdf.dll" & vbNullChar, 0, 0, 0, "", "")
Result = PEStartPrintJob(ReportJob, 1)
PEClosePrintJob (ReportJob)
PECloseEngine

Your help is appreciated
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LangstonT
LangstonT

ASKER

Tomorrow first thing when I'm back at the shop I will try to view the report in the VB application. I should have mentioned in my first post that in another part of my application I open the database then delete an existing table and later add a new table. So my application does have access to the database. Perhaps I need to put a delay in after I close the database so as it can be open later through crystal.

I haven't tried opening the report in the stand alone viewer but using crystal itself the report opens and dispays as expected with data from both sources. From here I can export the report without a problem.

This is the same code I was using before adding Access.  In fact I have two copies of the report. One pointing only to the SQL based report and the other pointing to both. When I change the VB code to point to the first repot(SQL) it works. Then I change the code to point to the second report(SQL & Access) - it doesn't work.

There is no password on the database. I can open the database up and view/modify all of it contents through the access application. Then using my same system login I run my code and I get nothing.
I was thinking about your comment regarding permissions. I moved the access DB from the network to my local PC  and changed my code to point to the local drive. The program now works like a charm. On the network location I chose I don't have high enough permissions to perform what I'm trying to do. I can modify the contents of the database but It seems I need to be the owner of the DB.

Thanks for pointing me in the right direction.
Glad I could help

mlmcc
I think problem is with the Access. Access is not a true database and due to this the records that are added in it takes some time which is greater than the time the crystal report takes to execute the report as a result nothing is displayed in the report. Try to debug and then it will show the records as while debugging the time consumption is more.