control to hold a single value in a report. (access 2002)

25112
25112 used Ask the Experts™
on
please see attached..
what will be the right control to place where the marked green box is.

the query in the 'REPORT' whose property is highlighted is as below (simplified, leaving out the complex conditions)
SELECT field1, Field2, Field3,Field4
FROM Book_Table
WHERE Condition1 AND condition2
ORDER BY Field2 DESC;

The new field to introduce below the above 'REPORT' control, would be of the below format:
SELECT avg(Field3)
FROM Book_Table
WHERE Condition1 AND condition2
heaader.png
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2013
Commented:
I think you are overdoing your report with sub-reports. In my opinion, even the ones you have marked red should not be sub-reports, bu just normal Text Boxes.

As for the avg(Field3) you can either use a simple Text Box. In the control source type Avg(Field3)
Distinguished Expert 2017

Commented:
what will be the right control to place where the marked green box is.
Usage of controls is not arbitrary.  What do you want to see in the control?  It looks to me like you probably want another subreport.

Author

Commented:
>>What do you want to see in the control?
The new one will be an average.. so a single value.
the existing report (3 next to each other ) is a 3 column list..

if it is a single value, do you recommend subreport for any value/reason?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Distinguished Expert 2017
Commented:
If it is a single value, then you can create an unbound text box and put the calculation in the ControlSource:

=DAvg("somefield", "sometableorquery", "somecriteriaifnecessary")

Author

Commented:
the report source is a QUERY with
SELECT field1, Field2, Field3,Field4
 FROM Book_Table
 WHERE Condition1 AND condition2
 ORDER BY Field2 DESC;

for
SELECT avg(Field3)
 FROM Book_Table
 WHERE Condition1 AND condition2
in txt box, you mentioned: DAvg instead of avg. is that for specific reason?

so, will be it format like:
DAvg("Field3", "Book_Table", "Column1=1 AND Column2=2")
Distinguished Expert 2017

Commented:
Is that a question?

Author

Commented:
thank you for confirming

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial