473,799 Members | 3,197 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using AVG in a report

Hi All,
In an AccessXP report in a Group Footer I have the following in a
textbox and I don't think its working.
Question; Is AccessXP smart enough to know to first sum up all the
values of
[DaysToReferral] and count how many before it calculates the average
for only those records
that met the criteria? or is it just capturing the last value for
that grouping and calculating it.

=Avg(IIf([dtMonth]=Forms!frmMainM enu!bxComprMth And [dtYear]=Forms!
frmMainMenu!bxP riorYrDte And [CatType]="DRef",[DaysToReferral],0))

thanks
bobh.

Jan 30 '07 #1
3 1468
bobh wrote:
>Hi All,
In an AccessXP report in a Group Footer I have the following in a
textbox and I don't think its working.
Question; Is AccessXP smart enough to know to first sum up all the
values of
[DaysToReferral] and count how many before it calculates the average
for only those records
that met the criteria? or is it just capturing the last value for
that grouping and calculating it.

=Avg(IIf([dtMonth]=Forms!frmMainM enu!bxComprMth And [dtYear]=Forms!
frmMainMenu!bx PriorYrDte And [CatType]="DRef",[DaysToReferral],0))

Is your problem because you are using 0 for records that
don't meet your criteria? Normally, you should use Null
instead of 0.

--
Marsh
Jan 30 '07 #2
It has made no difference whether I use '0' or 'null' or ""

and so the question still remains........ .... in this case is Access
doing the right calc or is it just calc on the last record read into
the grouping.
bobh.

On Jan 30, 12:37 pm, Marshall Barton <marshbar...@wo wway.comwrote:
bobhwrote:
Hi All,
In an AccessXP report in a Group Footer I have the following in a
textbox and I don't think its working.
Question; Is AccessXP smart enough to know to first sum up all the
values of
[DaysToReferral] and count how many before it calculates the average
for only those records
that met the criteria? or is it just capturing the last value for
that grouping and calculating it.
=Avg(IIf([dtMonth]=Forms!frmMainM enu!bxComprMth And [dtYear]=Forms!
frmMainMenu!bxP riorYrDte And [CatType]="DRef",[DaysToReferral],0))

Is your problem because you are using 0 for records that
don't meet your criteria? Normally, you should use Null
instead of 0.

--
Marsh

Jan 30 '07 #3
If you want it to count only the non-Null values, then you
need to use Null. If you want to count all the records,
then use 0. Do not use quotes around either the 0 the Null.

Using Null worked for my tests. Maybe the [DaysToReferral]
field does not contain the values you think it does??
Either that or your report has something going on that I am
not aware of.
--
Marsh
bobh wrote:
>It has made no difference whether I use '0' or 'null' or ""

and so the question still remains........ .... in this case is Access
doing the right calc or is it just calc on the last record read into
the grouping.
bobh.

On Jan 30, 12:37 pm, Marshall Barton <marshbar...@wo wway.comwrote:
>bobhwrote:
>Hi All,
In an AccessXP report in a Group Footer I have the following in a
textbox and I don't think its working.
Question; Is AccessXP smart enough to know to first sum up all the
values of
[DaysToReferral] and count how many before it calculates the average
for only those records
that met the criteria? or is it just capturing the last value for
that grouping and calculating it.
>=Avg(IIf([dtMonth]=Forms!frmMainM enu!bxComprMth And [dtYear]=Forms!
frmMainMenu!bx PriorYrDte And [CatType]="DRef",[DaysToReferral],0))

Is your problem because you are using 0 for records that
don't meet your criteria? Normally, you should use Null
instead of 0.
Jan 30 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1739
by: Mike Partridge | last post by:
Is it possible to access your caller's (not parent) context while inside a <xsl:template match...> or <xsl:for-each...>? Here is the xml I'm using: <report-set> ...<report> .....<detail-data> .......<detail-column position="1" dsc="col1" sum_fg="0"/> .......<detail-column position="2" dsc="col2" sum_fg="1"/> .......<detail-column position="3" dsc="col3" sum_fg="1"/>
9
3080
by: Colin McGuire | last post by:
Hi, I have an report in Microsoft Access and it displays everything in the table. One column called "DECISION" in the table has either 1,2, or 3 in it. On my report it displays 1, 2, or 3. I want to appear in the report is Yes, No, or Maybe. What do I need to do to change what appears in the report/what term do I need to search out in Google? Thank you Colin
11
6604
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on where the job is running, the job runs sucessfully, PDF files got generated, everything is good. If I scheduled the job to run at the time that I am not logged into the server, Access is not able to print to the printer. The error is pretty...
2
9352
by: amith.srinivas | last post by:
Hi all, From a word macro in VBA, I am trying to create a report in access DB. The report is based on a query with a parameter. I am using Set rpt = Application.CreateReport rpt.RecordSource = <<Query_Name>> Once I create the report, I m trying to create labels to display the Report title in the Report Header section.
10
2585
by: john | last post by:
I have a report to print envelopes. The report is based on a query. Now I need to make 10 more queries to make different selections of addresses. Every query has the same output fields as the already existing query. I know I can copy the report and base it on another query but then I would have to make 10 extra reports. How can I use just one report for all of the queries? At the moment I use the button wizard in my forms to make buttons...
3
2903
by: Blasting Cap | last post by:
I'm using VS 2005, SQL 2005 reporting services. SQL reporting services is working, and I have it both on my local computer, as well as on a server. I've created a report in the SQL Business Intelligence development studio that works in that environment. I've uploaded the same report to both the Reporting services on my local computer as well as the server, and can log in to them and run the
4
4529
by: Fran | last post by:
I recently tried to use code for "Use a multi-select list box to filter a report" from Allen Browne in my database. I was able to add the code and adapt it to my needs, however I am getting an error. I click Ok and the report opens. I look in the design view and the filter is there but the IN equals "" (it is blank, the values are not in there)
1
2441
by: sphinney | last post by:
All, I'm creating a new report via code using the following lines: Dim rpt As Report Set rpt = CreateReport(, "PIVOT_SUMMARY_tmp") Problem is Access 2002 (VB) is not using the template report (denoted by "PIVOT_SUMMARY_tmp") when it creates the new report. Access just uses the default report template which is a blank slate. I'm pretty sure that I'm using the correct syntax. I've even referred to Mary McCarthy's article Create...
25
11666
smithj14
by: smithj14 | last post by:
I have a form that has an option group (fraReports) which holds a list of reports to print. This part works fine. I select a report name and click print and that report opens. Now I want to add a text box to enter a service date that will open the selected report using the text box value (service date) to filter the report to only those dates. I have the field using the format "mmmm-yyyy" on all my forms and reports so it will show May-2009....
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10470
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10247
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9067
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6803
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5459
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5583
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2935
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.