Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating & Manipulating a Crystal Reports Object
Message
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00436248
Message ID:
00437988
Views:
21
Here it is, to use the RDC (I manipulated some code I found in a tech manual years ago, updating it for the RDC--I'm doing it now). Vw_cryst is an empty form. You can optionally add some code in the resize event of that form so that the crviewer1 Crystal viewer, which can only be added at runtime (trust me on this), will fill the screen as the user resizes.

FYI, I'm not using the v_outfile and v_outtype anymore--the output can be redirected from the screen to the printer, and I have no use at this time for outfile. Sadly, there's no one place where the methods exist in the Crystal documentation (I had to call and beg for the DBF method). However, here are some relatively-good-on-concepts-but-somehow-miss-the-mark-in-execution Help files that you can find on the Crystal 8 CD: crrdc.hlp; developr.hlp.

A very good resource is www.seagatesoftware.com/kbase, article #c2006956, but if you copy and paste the following code, you'll get 99 percent of what you need here.

Also, a tech support guy sent me the following note, but I didn't end up using it (however, if you have diffent issues, you may need it).
You can also search for RDC* at :
http://community.seagatesoftware.com/updates/default.asp
http://community.seagatesoftware.com/library/default.asp
for sample applications and whitepapers.

BTW, if you don't do it this way, you get "issues" if you work in different environments (W98 v. NTW, NTW v. Citrix Server (TS), etc.). I strongly suggest this method.

JR

PARAMETERS V_CRFILE,V_TABLE,V_OUTFILE,V_OUTTYPE
PRIVATE V_CRFILE,V_OUTFILE,V_OUTTYPE,V_RTN
* V_CRFILE = Fully pathed Crystal report to run
* V_TABLE = Fully pathed Fox 2X table to use
* V_OUTFILE = Fully pathed Output file name
* V_OUTTYPE = Output type (0 is preview)

V_Rtn =.T.
ON ERROR V_Rtn =.F.
IF FILE(V_CRFile) AND FILE(V_Table)
crApp=createobject("crystalruntime.application")
crReport=createobject("crystalruntime.report")
crReport=crApp.openreport(v_crfile)
crReport.Database.Tables.Item(1).Location=v_table
DO FORM vw_cryst
WITH vw_cryst
.addobject('crviewer1','olecontrol','crviewer.crviewer')
WITH .crViewer1
.height=vw_cryst.height
.width=vw_cryst.width
.visible=.t.
.reportsource=crReport
.ViewReport=MESSAGEBOX("Processing completed. You may view the report, or you may print from the preview window.")
ENDWITH
ENDWITH
ELSE
V_Rtn =.F.
=MESSAGEBOX("Missing Crystal report or Fox2x table! ",48,"CrystFox")
ENDIF
ON ERROR

RETURN V_RTN

PS--I've got a little problem with this, and that is an issue with the fact that sometimes my forms are showing up on top of the crystal view window. However, I think it's because of the forms that are calling it, not the vw_crystal form, because it works with some forms. I'll be posting the issue in the forms area--check that thread for the answer if you end up with the same problem.
CLARC Services, Inc.
3500 Tamiami Trail
Port Charlotte, FL 33952
www.clarc.com
(941) 743-0108
(800) 246-5488
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform