Access with Crystal reports.. (1 Viewer)

Bosch

Registered User.
Local time
Yesterday, 19:48
Joined
May 13, 2005
Messages
89
Hope someone here can help me with this.

I am using access 2003 and Crystal reports XI.
I have created some reports using CRXI that access my access database.
I use the following code to open the standard reports. MyReportFile is the name of my rpt file. I have no problems here.

Set crxReport = crxApplication.OpenReport(MyReportFile, acViewDesign)
CRViewer1.ReportSource = crxReport

But when I use the following code to use the recordset as source for the report, everything works the same - opens the report with data from the recordset..
Problem is after I close the application, access window will not close. The only way I can close is by task manager. If the following code is not executed then I could close the access window. I get no error messages.
When I run the same application with Access runtime version I get the message "Execution of this application has stopped due to a run-time error. The application can't continue and will be shut down.". But will not let me close the access window.

Any ideas will be appreciated.

Set crxReport = crxApplication.OpenReport(MyReportFile, acViewDesign)
crxReport.DiscardSavedData
crxReport.Database.SetDataSource SearchResults_rst
Set crxReport = crxApplication.OpenReport(MyReportFile, acViewDesign)
CRViewer1.ReportSource = crxReport


Thanks in advance.
 

FoFa

Registered User.
Local time
Yesterday, 21:48
Joined
Jan 29, 2003
Messages
3,672
Have you tried crxReport.close
or SET crxReport = nothing

Just guessing here.
 

Bosch

Registered User.
Local time
Yesterday, 19:48
Joined
May 13, 2005
Messages
89
FoFA..thanks for the reply.
I already have
set crxReport = Nothing..

I am not sure if it is anything to do with ADO / DAO objects.
recordset that I pass to the report is a DAO object.

Let me know if you have any ideas on this.

Thanks
 

FoFa

Registered User.
Local time
Yesterday, 21:48
Joined
Jan 29, 2003
Messages
3,672
Make sure you are closing any resource crystal uses prior to closing crystal (I.E. close the recordset/s as an example).
 

Bosch

Registered User.
Local time
Yesterday, 19:48
Joined
May 13, 2005
Messages
89
FoFa..thanks again..
I tried that..but same problem.

I am wondering if I can kill the CRViewer object before closing the form that has it.. I am not sure how to kill an object..

Thanks
 

Bosch

Registered User.
Local time
Yesterday, 19:48
Joined
May 13, 2005
Messages
89
Any ideas on this..anyone?
If you are using Crystal reports with Access, please post the code here.

Thanks
 

Bosch

Registered User.
Local time
Yesterday, 19:48
Joined
May 13, 2005
Messages
89
ADO did the trick.

Finally figured out what the problem was and it was what I suspected.

All along I have been using DAO in my application.
For some reason Crystal reports does not like DAO. I converted my recordset to ADO then it works ok.
 

Users who are viewing this thread

Top Bottom