>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