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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I programatically set control source of report from form 2

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
0
0
GB
Is it possible to set the control source of a textbox in a report from form?, and that it will work in an MDE version?

Form name is Form1, Report Name is Report1, Textbox on report is TXT1, control source might be set to data1,data2,etc

Many thanks
 
Provided the form is open when the report is launched you may use code like this in the OnFormat event procedure of the report's section:
If someCondition Then
strData = "data1"
Else
strData = "data2"
End If
Me![TXT1] = Forms!Form1(strData).Value

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Many thanks, have a good weekend.
 
Thank you very much.

I put the code into a SetValue Macro and I used the OnFormat Event in the Report Designer for all of the Reports that I want to set the TEXT from the calling Form.

It was easy but I was missing the correct Event from you.
TEK-TIPS!!!!
 
Hi,

"It was easy but I was missing the correct Event from you."

I used the method PHV posted, and gave him a star. I used the OnFormat event of the report, as my form stays open below the report. That was it and worked well. Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top