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

Passing value/variable from a form to a report

Status
Not open for further replies.

dkwong

MIS
Dec 27, 2001
76
0
0
CA
Hello there,

I have a report that uses the parameters from a form. I want to display those parameters on the report to let the user know what parameters he selected. For example, if the report shows all the courses offered by Vendor A and in Cateogory B, I want to show Vendor A and Category B in the report header. How can I pass a variable or value that I've defined on the form and display it as text on a report. Currently, the form runs a query and the values selected in combo boxes are specified in a where clause on a DoCmd.Open Report command. I can't get the report to display a variable that I've defined in the form (probably because it's a local variable). Thanks, hope this is clear.
 
you say the values you want are in combo boxes on the form? leave the form open while you preview the report. then on the report, you can reference them.

forms!FormName!cboVendorBoxName
forms!FormName!cboCategoryBoxName

i.e. in your header, make a text box and set it's source to:

Code:
="Open Invoices for " & forms!FormName!cboVendorBoxName & " for Category " & forms!FormName!cboCategoryBoxName

substitute your form name and combo box names.
you can do the same with other controls too--text boxes, etc.


g

 
Not necessarily just the combo box values, I want to pass a variable I've defined on the form and be able to display it on the report once I run the DoCmd.OpenReport.

Thanks!
 
Anybody have any more thoughts on this? Thanks in advance!
 
i just did this in a way on a form, i made a module, and declared global variable and in form set the global variable to the form variable. i am not sure if this helps.
 
Don't know if it helps, but I have a report that is generated based on the current record in a form, then exported.

I'm using a macro to pass the current record (the variable) to a report that is based on that parameter.

Respond with your email, I'll send it to you. You are more than welcome to look at it, I just don't know if it is exactly what you are trying to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top