Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pass variable to the report
Message
From
29/11/2005 06:08:18
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
29/11/2005 04:01:58
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01072697
Message ID:
01072714
Views:
21
>Hi,
>I have a variable, txtCompanyName, create in a report using report designer,
>I want the variable txtCompanyName contain the Company Name which pass from a Form by press the command button which have following code.
>
>
>txtCompanyName="ABC Company"
>REPORT FORM incrpt16.frx TO PRINTER NOCONSOLE PREVIEW
>
>
>The result not success,how to pass the Company name to the variable in the report ?
>
>Please advise.
>
>Thanks.
>Derek

Derek,
You dont' need to create a variable in report. Just define it in the calling program (it could be local, private .. etc.). Report is a command and thus have access to all variables (including form objects) accessible by the calling routine.

ie:
public oForm
oForm = createobject('myForm')
oForm.Show

define class myForm as Form
add object myTextBox as textbox
add object myButton as CommandButton with top = 50

Procedure myButton.Click
local txtCompanyName
txtCompanyName="ABC Company"
report form myReport preview
endproc
enddefine
myReport could use fields with expressions like:

m.txtComapanyName
thisform.myTextBox.Value

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform