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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question how to proceed with this problem

Status
Not open for further replies.

rekhatr10

Programmer
Apr 2, 2004
67
US
Hi everyone,

Access 97 and CR 7.0

I have developed reports in crystal and opening in Access. The problem I am having the report opens for a second and closes in the preview mode. I need it to be opened so that user can print. Below is my code any suggestions will be helpfful.


Dim crpApplication As CRPEAuto.Application
Dim crpReport As CRPEAuto.Report

Set crpApplication = CreateObjec("crystal.crpe.application")
Set crpReport = crpApplication.OpenReport"H:\PatientSurvey\AgeRpt.rpt")
crpReport.Preview
How can I make it stop and resume maybe after a minute or so.?


Thank you in advance
Rekha
 
Make sure your object variables are global rather than local to the procedure. Otherwise, they go out of scope once the procedure is done.

hth,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Ido

How do i make the variables global in this context. I am using a command button to run the report

Private Sub cmdRpt_Click()
Dim crpApplication As CRPEAuto.Application
Dim crpReport As CRPEAuto.Report

Set crpApplication = CreateObject("crystal.crpe.application")
If cmbReport.Value = "Satisfaction by Age" Then
Set crpReport = crpApplication.OpenReport("C:\MRMC\CREPORT7\reports\Xtreme\Customer.rpt")
crpReport.Preview
End Sub
Do I need tomake this public subRpt_click and will it make it global.

Thank you for your advice.

Rekha
 
The problem is not with the prcedure being private or public but with the scope of:
Dim crpApplication As CRPEAuto.Application
Dim crpReport As CRPEAuto.Report

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Ido,


Thank you very much for the advice. It works fine now. I do have another question I have created the reports using ODBC connection. The first time I open the reeport it give me an error message. But when I open the report in crystal and do log on server and then open the report in acces it works fine. How do I get so that I don't have to do it all the time.

Thank you
Rekha
 
Please start a new thread and provide more detail. If you are connecting to a secure data source, your code must take care of that aspect.

You may benefit from studying some code samples (available on BO web site).

hth,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top