Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Integrating Crystal Report into VFP
Message
 
To
27/03/2002 23:58:57
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00637982
Message ID:
00638314
Views:
19
Ravi,

Put your VPF form on the screen. Open up the Forms Control toolbar. Choose the OLE Container control (bsae class is OLEControl). When you add the OLE Container control to a form, you can choose the ActiveX control you want to add to the form. Then choose Crystal control that you want. If you want to add additional Crystal controls, then you repeat the process.

Choose the Control Type called Crystal Report Control. That works for ActiveX. To repeat, From the Form COntrols toolbar, choose OLE container control and drag it to size in the form. Then, in the Insert Object dialog box, choose Insert Control. In the Control Type list, select the desired ActiveX Control. Choose OK.

Sometimes it takes awhile for the list to refesh when you choose Insert Control inside the Insert Object window, so be patient. Look at the sample I sent you to see how the ActiveX properties are set and to see how to run and pass parameters from the VFP report form to Crystal.

If you make your reports in Crystal using ODBC VFP tables and get them running first in Crystal and not worry about VFP right now, then you can add the VFP form later. The Crystal Reports will be working either way without you having to change anything on the Crystal side. Meaning the reports will work with or without VFP interface.

Don't let the Data Source Name (DSN) stuff confuse you like I did. If you have a Crystal Report with a table at location c:\mydir\mytable. In order for Crystal or VFP to find it, you need to set the location c:\mydir\mytable using the ODBC Administrator. To do that, go to Window Control Panel, go to ODBC Administrator (sometimes called 32-bit), choose VFP tables on list, click on Configure button next to list, then enter the c:\mydir\mytable where it says free table\directory path and have ODBC or VFP clicked on (can't remember exact wording). Your Crystal Report may run fine without doing this, but if the report flashes on the screen and disappears you know that you need to do this. This sets up a DSN default for ODBC VFP table usage.

The part I find confusing is when you have several Crystal Reports. Report A might use a table at location c:\mydir\mytable, Report B might use a table at location c:\mydir2\mytable2. In which case you need to go into the ODBC Administrator and change the location prior to running the Report B or the report will flash on the screen and disappear. But as you can see, it would be a pain to keep going back to the ODBC Admin to change paths every time you ran a different report using ODBC VFP tables. So I have learned you have to do the DSN thing using the ODBC Admin under Control Panel for reports that use tables in different directories. If all of my reports use tables in c:\mydir, then I only make one DSN name for all to use. If I have reports using tables all over the place, then I have to make multiple DSN names.

The part I am getting ready to do is taking the multiple DSN names and incorporate that into the sample I sent you. According to Bernhart Milcent and Crystal tech support I can pass the DSN info from VFP form to Crystal Report the same time I pass other parameters from VFP form to Crystal. This saves me having to manually run ODBC Admin when I switch reports that use tables in different locations. If you use FOX2X tables, I don't think this ODBC Admin comes into play at all.
Steve Kramer
Kramer & Kramer Design
"Home of Go Cartoons"
Web Site: www.stephenkramer.com
Would you believe Far Side Lite?
More than 270 original cartoons.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform