Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crystal 7 ActiveX Control - - ParameterFields Property
Message
From
03/02/2000 03:29:00
Walter Meester
HoogkarspelNetherlands
 
 
To
02/02/2000 13:19:29
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00325861
Message ID:
00326571
Views:
35
James,
>
>I have implemented the automation server approach. I have another question for you . . when I execute the oReport.Preveiw
>command the report just flashes on the screen. Do you know how I can make it stay on the screen and then allow the user to print
>the report from the preview? I'm using Crystal 7.

This is probably because the oReport variable goes out of scope, and therefore releases it at the end of the method,procedure.

I've been busy with the CR7 report handling within my personal framework for the last few days Let's tell me how I implemented it.

I've got one custom class which contains all the code for:
- Opening the engine
- Open the report
- Open the data (temporary files)
- printing
- Setting printer (Beware of HP 6 printer drivers: reset the numeric cooprocessor to avoid problems (DECLARE _fpreset IN msvcrt20.dll, =_fpreset() before and after any code which adresses printers) note this also applies to VFP 6 SP3.
- Error handling (When a user cancels a print, an OLE error is raised).

I use this class in four other classes:
- a modal print dialog, with export and preview buttons, invoked when a user explicitly want to print a document in two ways:
. 1. When the user chooses the menuitem ' print ' the dialog pops up, let you change the printer, and orientation if you like.
. 2. When the user chooses the toolbutton to print, the dialog stays invisible, but prints the document directly to the printer.
- a modal preview class: a Formclass with a FoxHwnd control in which the preview is displayed. This class is called by the modal print dialog. To resize the CR7 reportpreview to the formsize you must use the SetWindowPos API
- a modeless preview form, invoked when choosen for a preview from eiter a menuitem and a toolbutton. This enables you to have more than one preview active at the time (each preview is a separate window). From the toolbar you can choose for printing directly. Form the menuitem you can display a modal print dialog the print the report shown in the preview.
- A modal print dialog which enables you to print from a modeless preview. The only visual difference with the first print dialog is that this one has no preview and export buttons.

Aside from these classes, I've got a CRtoolbar to show options like First page, previous page, go page, next page, last page, zoom factor (up to 400%) and export (to word, RTF, HTML, Text, Excell, etc)


To come back to your original question, How to make the preview persistent ? In my cases I make a form inherited from the modeless preview dialog and simply issue the following command when I want to preview the report:

DO FORM CrDirectPreview WITH cReportfile, cWindowCaption, arrayofTempfilesToBeUsedInReport

Now the previewform shows up in a modeless way (so the other menuitems are also available) and you're able to minimize the preview and continue with some other work.

HTH,

Walter,




>>James,
>>
>>I have very briefly with the ActiveX control and moved to the automation approach soon after. The automation server provides you more control and flexibility and is certainly not more difficult than the activeX control. A few day's back i've given an example to pass paramters from VFP to Crystal Reports. See the thread #324615 "Crystal Reports" at 01/29/2000.
>>
>>As for get it to work with the automation control, be sure you pass the right value to the right parameter. The zero parameter in your example refers to the first parameterfield you've created within the report regardless of the name (you did create the parameterfields up there, didn't you ?). Further on you might chack if the parametertypes match (integer, logical, dat, string, etc).
>>
>>>ThisForm.olePrint1.ParameterFields(0) = "paramater1;&userid;TRUE"
>>
>>I've noticed that you use &userid. It looks like if you're trying to pass a numeric value by using marco substitution: CR might interpretate this as a string. You might want to try:
>>
>>>ThisForm.olePrint1.ParameterFields(0) = "paramater1;"+STR(userid)+";TRUE"
>>
>>another hint might be the typo of the word "paramater1" which probably should read "Parameter1".
>>
>>HTH
>>
>>Walter,
>>
>>
>>
>>>Has anyone used the ParameterFields Property in Crystal 7 ActiveX? I want to pass a parameter to the report from Visual Fox 6
>>>and print the report based on a user id and not have the user prompted to enter it.
>>>
>>>My code is:
>>>
>>
>>>
>>>The error I'm getting is:
>>>
>>>Error Number 1429
>>>OLE IDispatch exception code 0 from CrystalReport. Invalid parameter field name . . .
>>>
>>>
>>>
>>>I'm not sure if I'm missing something else I need, or what. Any information would be appreciated.
>>>Crystal Report help isn't the best I've seen around!
>>>
>>>Thanks,
>>>
>>>James Colson
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform