473,803 Members | 3,022 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AVG fails in report with nulls

ACC 97 - Report with multiple grouping levels. Report footers have text
controls with controlsource: "=Avg([field1])". The report's Recordsource was
changed so field1 contains null (instead of zero) for no value, because the
avearages were misleading. After that change, the report fails with the
following error:

"The Microsoft Jet database engine could not execute the SQL statement
because it contains a field that has an invalid data type."

Remove Avg and report executes, same error if Avg replaced with Sum.

I tried getting around it using:
=Sum(IIf(IsNull ([field1]),0,[field1]))/txtField1Count, where
txtField1Count. Controlsource = "Count([field1])" and other variations of
dividing text controls with appropriat Count and Sum. I also tried
explicitly coercing field1 to numeric value in source query. No Joy.

The KB (210458) indicates the Avg() function should handle nulls. What am I
missing?

..
Aug 21 '07 #1
1 1524
I don't have Access 97 easily available here, but used the Report Wizard to
create a Report in Access 2003, and it did not exhibit the phenomenon you
describe.

Knowledge Base Article 109364 applies to Access 97 and previous, but it says
essentially the same thing as the article you cite (which applies to Access
2000) that AVG ignores Nulls. But you can't assume that a KB article is
"retroactiv e" and applies to previous versions unless it so states.

You might check that you have both Service Releases and all updates applied
to your installation of Access 97. Other than that, I can only speculate
that something "has gone wrong" with a DLL that supports these functions
(and I don't know which that would be). I am reluctant to suggest that you
uninstall and reinstall Access 97, and the Service Releases, and updates, as
it only _might_ help with the problem. But, it may be the only thing that
would help.

Perhaps, if you have multiple versions of Access installed in the same
directory/folder, that could be a problem, but I have no specific
information on its applicability to _this_ problem.

Larry Linson
Microsoft Access MVP


"Dennis Hartmann" <dh*******@mlco st.comwrote in message
news:13******** *****@corp.supe rnews.com...
ACC 97 - Report with multiple grouping levels. Report footers have text
controls with controlsource: "=Avg([field1])". The report's Recordsource
was
changed so field1 contains null (instead of zero) for no value, because
the
avearages were misleading. After that change, the report fails with the
following error:

"The Microsoft Jet database engine could not execute the SQL statement
because it contains a field that has an invalid data type."

Remove Avg and report executes, same error if Avg replaced with Sum.

I tried getting around it using:
=Sum(IIf(IsNull ([field1]),0,[field1]))/txtField1Count, where
txtField1Count. Controlsource = "Count([field1])" and other variations of
dividing text controls with appropriat Count and Sum. I also tried
explicitly coercing field1 to numeric value in source query. No Joy.

The KB (210458) indicates the Avg() function should handle nulls. What am
I
missing?

.


Aug 21 '07 #2

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

Similar topics

1
8745
by: Larry Peeters | last post by:
Hi, I have created a very simple query to link two tables on 4 fields. However, in certain cases, one of the fields used to link the table may contain nulls (in both tables, so this should still be a match). Access won't return these records. If the fields are filled with actual values, everything is fine. Can somebody help me on this one?
4
2723
by: VivN | last post by:
I want to use an expression as the control source for a text box in a report (Access 2000). Whilst I have sucessfully used these simple ones =TimeToSingle(TotalHours(,)) =TimeToSingle(BHolHours(,,)) I get problems when I include a text parameter Scale (control just displays #error)
12
2069
by: Stephen Poley | last post by:
I have a report which prints data from a parent table and two child tables (Contract and Kosten). Because it is a bit long, I suppress some fields which are often empty, based on methods found in the archive for this group: allowing can-shrink on the field itself and the following code in the details section to suppress the label: If (Me!InpassingWerkproces.Text = "") Then Me!InpassingWerkproces_Bijschrift.Visible = False Else...
12
6652
by: jkearns | last post by:
Hello, I made a report from a crosstab query following the steps onlined in MSDN's Solutions.mdb example. I now have a dynamic crosstab report (great!), but with one minor problem. I cannot get access to show NULL and 0 values seperately. I've tried the following Format properties in my text box: 0.0;;0;"" --> Both NULL and 0 values display as 0 0.0;;"";"" --> Both NULL and 0 values show up blank
1
2265
by: Daniel Martini | last post by:
Hi all, I'm currently coding some functions in plpgsql for generating reports out of records in a table. Problem is: NULL values in records make the complete function fail. Here is a simple test case (original is more complex with a multi- table query in the for qres in select... part): create table test( id serial,
5
3355
by: David L. | last post by:
I'm running into a frustrating problem. ASP.NET 2.0 web application, against SQL'05, I'm trying to run a report against a 'table provider' (query) that excutes well within SQL MGT studio, and within the data environment. However, when the report is executed in a web report viewer, the report engine comes back with: An error has occurred during report processing.
3
1671
by: erick-flores | last post by:
Hello all I am creating an Expense Report. There are to types of expenses: Company expenses and Reimb Expeneses. The company expenses is under "Expense Details Co" table and Reimb Expenses is under "Expense Details" table. So I am creating this final report to see both type of expenses separately but I CANT. I got this report design from a website, but it only came with one "Expense Details" table, so I add the Expense Details Co. The...
6
5458
by: Brett Barry: Go Get Geek! | last post by:
Hello, I have a main report with a Record Source, a DateToday table, that has the current Month and Year. I have about 60 queries, each pulling different data via ODBC, that I am creating subreports that go on the main report. The problem is that when I run the report the data shows on the screen but not the print preview. I am aware that the main report is not linked to the subreports because of the Link Master, Child Fields issue....
0
1191
by: =?Utf-8?B?VmlqYXkgR2FuZXNo?= | last post by:
We are using a logo by calling Image.FromFile(). Based on that we are opening a report (using a 3rd party Report generation tool) and without closing the report, We are trying to change the logo by calling File.Copy, at that time application fails to copy and throws exception. The report is somehow locking locking the logo file, and that's why the copy into the logo file fails. But how do we disassociate the logo file from the created...
0
9700
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
10546
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
10310
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...
1
10292
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7603
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6841
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();...
2
3796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2970
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.