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

Send calculated variable to a report

Status
Not open for further replies.

alpder

Technical User
Sep 22, 2002
103
AU
I would be grateful for some help.

I have calculated a variable in a module which I want to appear on a report header.
So far I have calculated the variable, declared it global and referenced it in the control source of a text box of the report. When I run the report it asks for the value of the variable as user input rather than getting it from the value of the variable.

Does anyone have a suggestion?
 
You could create a function that returns the variable ie:
Function GetMyVar() as String
GetMyVar = gstrMyVariable
End Function

Then set the control source of the text box to:
=GetMyVar()

Duane
MS Access MVP
 
Duane,

Thanks for your reply - but I have done what you suggested and created the function that returns the variable. On the report, i have set the control source of the text box to the calculated variable, but it still asks for the value of the variable as user input. I have set the variable to a global variable, but that did not help.

 
Don't set the control source to the calculated variable. Set the control source to the function that returns the calculated variable.

Duane
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top