
Using Access form as Crystal Reports viewer
Crystal (at cystaldecisions.com) has a white paper on using a
Visual Basic 6
form to house the
Crystal Reports Viewer. This viewer brings up a selected
Crystal report in preview mode, and allows it to be printed or exported to a
variety of file types.
I've tried this out in VB6 and it works fine. However, I'm more comfortable
programming in the Access environment. I would like to develop a simple
front end to allow a client to print numerous reports off of their
SQL Server 2000 database.
When I check all 9 Crystal references in either Access 97 or Access 2000,
then apply the same VB6 code (see below) to a form, the viewer does come up,
only occupying about 25% of the screen, and it can't be made larger. Also,
there are no print or other buttons on the viewer toolbar. I can make
changes to the viewer ActiveX object, but the changes are not saved.
Here's the code suggested by Crystal Decisions for VB6:
Dim CRxApp As New CRAXDRT.Application
Dim crxrpt As CRAXDRT.Report
Private Sub Form_Load()
'use the OpenReport method of the Application object
Set crxrpt = CRxApp.OpenReport("c:\crystal\running totals.rpt")
CRViewer1.ReportSource = crxrpt
CRViewer1.ViewReport
End Sub
I would appreciate any thoughts on how to make this work in Access.
Bill