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

How do I run a Crystal Report from MS Access 97 1

Status
Not open for further replies.

shb46

Programmer
Jul 11, 2001
10
0
0
GB
I have several crystal reports (v8.5) which have MS Access 97 tables as their data source. The reports all run fine (There are no parameters within the reports), but I would like to be able to run them from within Access and hopefully export them to pdf format.

I am using the code below to open crystal and a specified report in design mode, but is it possible for me to open the report in Preview mode

Dim stAppName As String
stAppName = "C:\Program Files\Seagate Software\Crystal
Reports\crw32.exe C:\Temp\reportname.rpt"
Call Shell(stAppName, 1)

Many Thanks
Sue
 
Sue-

I built an Excel Add-In that has some user forms that launch crystal reports from buttons on the form. It's not Access but since it's VBA, shouldn't be far off where you need to be.

The project has references to the following:

Crystal Data Object
Crystal Report Viewer Control (Don't think I'm using this)
Crystal Reports 8.5 ActiveX Design Run Time Library


Option Explicit

Dim Appl As New CRAXDRT.Application
Dim Report1 As New CRAXDRT.Report


Private Sub cmdCharges_Report_Click()

frmMainMenu.MousePointer = fmMousePointerHourGlass

Set Report1 = Appl.OpenReport("c:\quarterly_reports\crystal_reports\charges.rpt")

End Sub


Hope it helps.
 
Did something very similar in Access 2000 recently. Previous post points to some references you'll need to "check" in your access database.

Code below may help:

***

Dim crxApp As CRAXDRT.Application
Dim crxReport As CRAXDRT.Report

Set crxApp = New CRAXDRT.Application
Set crxReport = crxApp.OpenReport(&quot;<insert your crystal report filename here(including path)>&quot;)

crxReport.DiscardSavedData

With crxReport.ExportOptions
.DestinationType = crEDTDiskFile
.FormatType = crEFTPortableDocFormat
.DiskFileName = &quot;<insert a destination filename here>&quot;
End With

crxReport.Export (False)

***

Hope this helps!

Les P
 
Thanks for that the code looks to be exactly what I need, but I get a compile error in Access 97 as it doesn't recognise the code

Appl As New CRAXDRT.Application

Any suggestions please on how to get this to work

Many Thanks
Sue
 
Two Thoughts come to mind with this error.

1. You do not have the corresponding reference libaries loaded in your project. I am not sure which libaries you would need but to access them Click
Code:
Tools->References
in the VBA window.

2. Access 97 may not support these data types. My guess option 1 will work if you can find the correct libaries.

I hope this helps narrow down the search for a solution

Jason Meckley
Database Analyst
WITF
 
Thanks for that, you were right it was option 1. I am now referencing the correct libaries and it's working fine.

Many Thanks
Sue
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top