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

Report Based on Calculations 1

Status
Not open for further replies.

nthompson

MIS
Feb 8, 2001
9
US
I need to generate a quarterly report (user input date parameters) that contains about 60 different calculations. I have been writing a procedure with a series of nested Case statements to produce the calculations. I thought they were too difficult to do in a query. How do I tie these calculations to a report? (I'm using Access 2000.) I only want the calculations on the report with some labels and other text, nothing else from the database. I'm new at Access and any suggestions would be greatly appreciated. Thanks!
 
Declare the variables of the calculations in a PUBLIC module as GLOBAL.

e.g.
[tab]Global MyCalVar1 as Single
[tab]Global MyCalVar2 as Integer


Execute the routine which does the calculations in the open event of the report.

Reference the global variables in hte report controls record source.

e.g.

MyRptTxt1.ControlSource: MyCalCal1

'__________________________________________________
A reasonable alternative would be to place each of the calculations in seperate mprocedures (Functions) in the report. Set the control source for each field to the appropiate procedure. Of course, you will still need to make the source variable available to the report module.



MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
I've tried using the global variables as suggested. However, it's telling me that I can only set the record source property to a table or query. Any thoughts?
 
You need to set the CONTROL Source, for each INDIVIDUAL control. Leave the Record Source empty.

The control source may be an expression which is NOT a field in the recordsource.

MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top