473,405 Members | 2,141 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,405 software developers and data experts.

"Overflow" error

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 same section
of code, but I can run the code a few times, then it appears. I can't
reproduce it when I want to, and I have no idea what is causing it.
Any ideas ? Thanks
By the way the code is some record manipulation of 2 recordsets.

Mar 24 '06 #1
3 44695
Overflow means that the data is too large for the data type that is trying
to handle it.

Open the Immediate Window (Ctrl+G), and enter:
? 200 * 200
The default number type in Access is Integer, and the largest integer is
32767. Therefore this simple calculation fails with an Overflow error. The
solution is to force one of the numbers to be a Long integer, e.g.:
? CLng(200) * 200

Your calculations may therefore need typecasting to a Long, Double, or
Currency, using CLng(), CDbl(), or CCur(). Note that these types do not
handle Null, so you usually need to use Nz() inside those expressions too,
e.g.:
CCur(Nz([Quantity],0)) * [PriceEach]

More info:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<Sh**********@KidNet.com> wrote in message
news:4420b3ce.218328@news-server...
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 same section
of code, but I can run the code a few times, then it appears. I can't
reproduce it when I want to, and I have no idea what is causing it.
Any ideas ? Thanks
By the way the code is some record manipulation of 2 recordsets.

Mar 24 '06 #2
Thank you, that was the problem...Just curious though, what is the
largest Long Integer ?
On Fri, 24 Mar 2006 11:09:02 +0800, "Allen Browne"
<Al*********@SeeSig.Invalid> wrote:
Overflow means that the data is too large for the data type that is trying
to handle it.

Open the Immediate Window (Ctrl+G), and enter:
? 200 * 200
The default number type in Access is Integer, and the largest integer is
32767. Therefore this simple calculation fails with an Overflow error. The
solution is to force one of the numbers to be a Long integer, e.g.:
? CLng(200) * 200

Your calculations may therefore need typecasting to a Long, Double, or
Currency, using CLng(), CDbl(), or CCur(). Note that these types do not
handle Null, so you usually need to use Nz() inside those expressions too,
e.g.:
CCur(Nz([Quantity],0)) * [PriceEach]

More info:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html


Mar 24 '06 #3
Sh**********@KidNet.com wrote:
Thank you, that was the problem...Just curious though, what is the
largest Long Integer ?
On Fri, 24 Mar 2006 11:09:02 +0800, "Allen Browne"
<Al*********@SeeSig.Invalid> wrote:
Overflow means that the data is too large for the data type that is trying
to handle it.

Open the Immediate Window (Ctrl+G), and enter:
? 200 * 200
The default number type in Access is Integer, and the largest integer is
32767. Therefore this simple calculation fails with an Overflow error. The
solution is to force one of the numbers to be a Long integer, e.g.:
? CLng(200) * 200

Your calculations may therefore need typecasting to a Long, Double, or
Currency, using CLng(), CDbl(), or CCur(). Note that these types do not
handle Null, so you usually need to use Nz() inside those expressions too,
e.g.:
CCur(Nz([Quantity],0)) * [PriceEach]

More info:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html


From the A2K help:

Long data type
A fundamental data type that holds long-integer numbers. A Long variable
is stored as a 32-bit (4-byte) number ranging in value from
-2,147,483,648 to 2,147,483,647.
--
Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.
Mar 24 '06 #4

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

Similar topics

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...
81
by: Matt | last post by:
I have 2 questions: 1. strlen returns an unsigned (size_t) quantity. Why is an unsigned value more approprate than a signed value? Why is unsighned value less appropriate? 2. Would there...
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
0
by: snowdream1982 | last post by:
Dear all, I hit an error OVERFLOW but when I insert the sql statement below manually in the SQLEditor, it goes well, no errors at all. My coding: SQLInsertTempMf = "INSERT INTO tempmf " &...
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 ,...
1
by: Amy Badgett | last post by:
I keep getting the error: "Overflow" with this piece of MS Access SQL coding: SELECT DISTINCT (SELECT Count(tblCallLog.tblCallLog_gospelPresented) FROM tblCallLog WHERE...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...
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
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,...
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.