Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report form with parameters?

Status
Not open for further replies.

TheBlainer

Programmer
Aug 31, 2011
37
CA
Hi
I'm trying to pass a variable that is a string in my code to my report, but I saw that we can't do that with REPORT FORM.

So I was wondering if there's a way to do that, because it must be possible with some trick. I created a variable on my report, but I don't know how to assign my value to it (if it's possible)

I also saw the Heading parameters for the command REPORT FORM, but it doesn't really do what I want.

Thanks in advance.

TheBlainer
 
I'm trying to pass a variable that is a string in my code to my report, but I saw that we can't do that with REPORT FORM

One way that I do this is just one more indication of my being a crusty 'old timer' in the FP/VFP development world, but it continues to work.

In my PRG or in a method within my FORM I declare a variable as PUBLIC.

Then I populate the variable, call the REPORT FORM where it can be used, and then RELEASE the variable.

Something like:
Code:
PUBLIC cRptTitle
DO CASE
   CASE <some criteria-1>
       cRptTitle = "This is Report Title value #1"
   
   CASE <some criteria-2>
       cRptTitle = "This is Report Title value #2"

   CASE <some criteria-3>
       cRptTitle = "This is Report Title value #3"
ENDCASE

SELECT MyRptData
REPORT FORM MyReport NOCONSOLE TO PRINT
RELEASE cRptTitle

I'd guess that others here may have other suggestions which may work equally well (or possibly better).

Good Luck,
JRB-Bldr
 
The variable doesn't need to be public, it doesn't even need to be private, it can be local, too. A report does have access to all variables in the same scope as the REPORT FORM command.

Bye, Olaf.
 
Thanks jrbbldr!
and also Mike and Olaf to make his answer better!

I declared a local variable called LTITLE in the function calling my REPORT FORM and put this name in one textbox on my report and it's working ^^

Thanks again.

TheBlainer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top