Pass Value From Form To Report

cheer

Registered User.
Local time
Today, 16:42
Joined
Oct 30, 2009
Messages
222
How to write the VBA to pass a value from a control in a form to a control in a report ?
 
Try the following code on your report;
Code:
=[Forms]![FormName]![ControlName]
 
If it will always be the same, just refer to the form in the report control:

=Forms!FormName.ControlName

If it will change, pass the value in the OpenArgs argument of OpenReport (first available in version 2002 or 2003).
 
Thanks above, How to write under the form the VBA to pass the value to report?

What you have stated above is code at report right? I am seeking any chance to write under form.
 
Under Form

DoCmd.OpenReport "Report_Machine_Utilisation_Time_Detail", acViewPreview, , strWhereClause

Reports![Report_Machine_Utilisation_Time_Detail]![txtStartDate].Value = strStartDate

Reports![Report_Machine_Utilisation_Time_Detail]![txtEndDate].Value = strEndDate

Under Report

How to receive the value send from FORM ?
 
Thanks above, How to write under the form the VBA to pass the value to report?

What you have stated above is code at report right? I am seeking any chance to write under form.

Just put it in the Control Source of a text box on you Report.
 
Just put it in the Control Source of a text box on you Report.

I have 2 questions here

a) Control source can link to the variable inside a form , for example strStartDate and strEndDate ?

b) How can we write the VBA in stead of through the windows ?
 
I have 2 questions here

a) Control source can link to the variable inside a form , for example strStartDate and strEndDate ?

........

Code:
=[Forms]![FormName]![ControlName]
Will return the current value in that control when you activate your report.


..........

b) How can we write the VBA in stead of through the windows ?
Not quite sure what you mean here.
 

Users who are viewing this thread

Back
Top Bottom