Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Run code in report form
Message
From
12/01/2009 16:59:07
 
 
To
12/01/2009 15:37:21
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
01372806
Message ID:
01372983
Views:
21
This message has been marked as the solution to the initial question of the thread.
>>>I want to be able to run a block of code in the report form when it first starts. How can I do that? The reason is that for this particular report, I want to run SQL against the current alias and create a generic cursor (Fld001, Fld001, etc.). This cannot be done in code priort to the REPORT FORM statement in the calling code.
>>
>>I have always placed embedded code in the Init and Destroy events. Right-click on the Report Design and select Data Environment. Right-click in the DE and select Properties. From the Properties dialog you then select code editor for the event. I generate my cursor in the Init event and close them in the end. Be sure to set the Data Session to Public so the report can see the already open tables and cursor.
>
>I like it and it works. Except for this. I put this code in the INIT:
>
>m.CurrentAlias = ALIAS()
>m.CurrentRecNo = RECNO()
>
>And this in the Destroy:
>
>SELECT (m.CurrentAlias)
>GOTO m.CurrentRecNo
>
>But they are out of scope in the Destroy. If it were a form, I would create a form property to hold them, but I did not see this for the report.

You can added as a report variable or with the THIS.AddProperty, or even as Public variables (be sure to release in the Destroy.) All these options allow the values to persist through out the reports run time.
Greg Reichert
Previous
Reply
Map
View

Click here to load this message in the networking platform