473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Access SQL error "Overflow"

I keep getting the error: "Overflow" with this piece of MS Access SQL coding:

Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT 
  2.  
  3. (SELECT Count(tblCallLog.tblCallLog_gospelPresented) FROM tblCallLog WHERE tblCallLog.tblCallLog_callDate = Date() AND tblCallLog.tblCallLog_callDate Is Not Null AND tblCallLog.tblCallLog_gospelPresented = true) AS todaysGospelPres,
  4.  
  5. (SELECT Count(tblCallLog.tblCallLog_gospelPresented) FROM tblCallLog INNER JOIN tblClients ON tblCallLog.tblCallLog_clientID = tblClients.tblClients_clientID WHERE tblCallLog.tblCallLog_callDate = Date() AND tblCallLog.tblCallLog_callDate Is Not Null AND tblCallLog.tblCallLog_gospelPresented = true AND tblClients.tblClients_jewish = true) AS todaysGospelPresJewish,
  6.  
  7. (todaysGospelPres - todaysGospelPresJewish) AS todaysGospelPresGentile,
  8.  
  9. Format((todaysGospelPresJewish / todaysGospelPres), "Percent") AS todaysJewishGospelPercent,
  10.  
  11. (todaysGospelPresJewish & ' (' & todaysJewishGospelPercent & ')') AS comboTodayJewishGospel
  12.  
  13. FROM tblCallLog INNER JOIN tblClients ON tblCallLog.tblCallLog_clientID = tblClients.tblClients_clientID;
  14.  
Does anyone have an idea why?
Apr 2 '11 #1
1 8041
Stewart Ross
2,545 Expert Mod 2GB
I think the most likely explanation is that there is a division by zero error happening, which gives rise to the overflow exception. Check the data in the underlying query carefully, and in particular look for the value of todaysGospelPres being 0 somewhere. This field is an alias for the Count done in line 3.

If you check line 9 of the SQL statement above you will see that this count is used as the divisor in the expression

Format((todaysGospelPresJewish / todaysGospelPres), "Percent")

One way of avoiding such an error is to test the value, and if it is 0 substitute a suitable value instead. There is more than one way to do this, so here are two examples:

Expand|Select|Wrap|Line Numbers
  1. IIF(todaysGospelPres <> 0,Format((todaysGospelPresJewish / todaysGospelPres), "Percent"), null) 
  2.  
  3. Format((todaysGospelPresJewish / IIF(todaysGospelPres=0, 1, todaysGospelPres)), "Percent")
The first method has the advantage that a null value is substituted for the whole expression when the divisor is 0, leading to a blank result. The second example has the disadavantage that you will not necessarily know that there is a zero divisor in the underlying data for that row, as it does a safe 'division by 1' leaving the value being divided unchanged.

It would be worth separating out the Count subquery in line 3 for test purposes and running it to see if any of the rows returned are showing 0. Count does not normally return 0 values, but I guess the overflow is indicating some kind of fault in the underlying data.

The only other explanation I can think of is that the database engine is finding the use of the subqueries too complex. Again, this can be tested by separating the subqueries and testing that each runs on their own, checking what values are returned.

-Stewart
Apr 2 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: aj | last post by:
DB2 v8 FP5 Red Hat AS/EL 2.1 I found the following in my db2diag.log: 2004-09-07-10.01.37.747898 Instance:oltp Node:000 PID:14637(db2agent (NDRDB)) TID:8192 ...
2
by: Andy Davis | last post by:
Dear Group I am trying to automate process of adding a new record id in my form using the following code when the user clicks the "Add New Record" button. For example if the last record id is...
4
by: Spook | last post by:
Running a particular Access report or the query associated with it brings up the warning "Overflow". What does this mean? WhatI have I done wrong? Both report and query were fine before lunch...
3
by: SheldonMopes | last post by:
I sometimes get a pop-up box that reads "Overflow" and the module that is executing pauses. It doesn't get caught by my error trapping, and it seems to be randow. By random, I mean usually in the...
7
by: Peter Ritchie | last post by:
I'm writing a Web Service and I would like to add performance counter data for monitoring performance of the Web Service's operations over time and load. The problem is, I get the "Requested...
5
xxoulmate
by: xxoulmate | last post by:
help on progress bar on error: "overflow" is the message., what is the cause of error., the progressbar value basis on the second(time) progressbar max value = 59 progressbar min value = 0
1
by: rileyjane | last post by:
Hello, I am running a Union query in Access 2003 that combines two other queries. When I run each query individually, they open fine with no problems. But when I try to run the Union query, I...
2
by: johnwaddy | last post by:
I'm clueless to the problem, I have a couple of account with 300+ records and all of a sudden when you recalc it reaches record 256 and pops up this "Overflow" error. I do not have any issues with...
1
by: Tami Robinson | last post by:
I keep getting !Overflow error when running this query: SELECT DISTINCTROW FamilyInfo.FamilyInfoID ,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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...

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.