Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Microsoft: FoxPro FAQ

COM and Automation

How can I run a Crystal Reports report from VFP? by foxdev
Posted: 28 Nov 00

(the information in this FAQ applies to version 8 of Seagate Crystal Reports, but may apply to other versions as well)

With just a few lines of code you can run, print, or export a Crystal Reports report that you have already designed.  If you have already designed and tested the report within CR, you can use the following techiques to invoke the report:

Export a report in Word format
oCRApp = createobject("crystal.crpe.application")
oRep = oCRApp.OpenReport("C:\MYREPORT.RPT")
oRep.ExportOptions.FormatType = 14  && Word
oRep.ExportOptions.DiskFileName = "c:\test.doc"
oRep.ExportOptions.DestinationType = 1  && disk file
oRep.Export(.F.) && .F. = no dialog box
release oRep
release oCRApp

In the above example, use FormatType 4 for RTF, 27 or 28 for Excel 7, 29 or 30 for Excel 8.

Preview a report
oCRApp = createobject("crystal.crpe.application")
oRep = oCRApp.OpenReport("C:\MYREPORT.RPT")

Print a report to the default printer
oCRApp = createobject("crystal.crpe.application")
oRep = oCRApp.OpenReport("C:\MYREPORT.RPT")
oRep.Printout(.F.) && .F. = no printer dialog

Back to Microsoft: FoxPro FAQ Index
Back to Microsoft: FoxPro Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close