473,811 Members | 2,717 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A97 overflow error returned when trying to calculate 192/(24*60*60) - why?

MLH
I have the following procedure in a form module in A97. I have
the NewOutRefDate global var declared in a standard module
named "Declaratio ns". It is dim'd as Variant.

Private Sub Command9_Click( )
NewOutRefDate = 192 / (24 * 60 * 60)
Debug.Print NewOutRefDate
End Sub

The attempted assignment fails with an overflow error when it
runs. Anybody know why? I thought variant sufficient to handle
this calculation.
Nov 13 '05 #1
6 1723
MLH
The following code gives me an error
Private Sub Command9_Click( )
Dim MyDbl As Double
MyDbl = 192 / (24 * 60 * 60)
Debug.Print MyDbl
But the following does not...
Private Sub Command9_Click( )
Dim MyDbl As Double
MyDbl = 4 / 7
Debug.Print MyDbl

I thought this unusual. Am I doing something wrong?
Nov 13 '05 #2
(24 * 60 * 60) must be trying to evaluate to an integer

192 / (cdbl(24) * 60 * 60) seems to work = 2.2222222222222 2E-03

but I don't know why

Nov 13 '05 #3

<le*********@na tpro.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
(24 * 60 * 60) must be trying to evaluate to an integer

192 / (cdbl(24) * 60 * 60) seems to work = 2.2222222222222 2E-03

but I don't know why


(24 * 60 * 60) = 86400 which is a bigger number then an Integer can hold.

(cdbl(24) * 60 * 60) converts it to a double which can hold 86400
Nov 13 '05 #4
MLH
On Wed, 7 Sep 2005 10:34:56 -0500, "paii, Ron" <pa**@packairin c.com>
wrote:

<le*********@n atpro.com> wrote in message
news:11******* *************** @g47g2000cwa.go oglegroups.com. ..
(24 * 60 * 60) must be trying to evaluate to an integer

192 / (cdbl(24) * 60 * 60) seems to work = 2.2222222222222 2E-03

but I don't know why


(24 * 60 * 60) = 86400 which is a bigger number then an Integer can hold.

(cdbl(24) * 60 * 60) converts it to a double which can hold 86400

xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxx
I was thinking that declaring NewOutRefDate As Variant would take
care of any memory allocation requirements. I guess I was wrong. It
does seem strange, though. A variant is the one variable type that
is big enough to manage any of the others.
Nov 13 '05 #5

"MLH" <CR**@NorthStat e.net> wrote in message
news:j8******** *************** *********@4ax.c om...
On Wed, 7 Sep 2005 10:34:56 -0500, "paii, Ron" <pa**@packairin c.com>
wrote:

<le*********@n atpro.com> wrote in message
news:11******* *************** @g47g2000cwa.go oglegroups.com. ..
(24 * 60 * 60) must be trying to evaluate to an integer

192 / (cdbl(24) * 60 * 60) seems to work = 2.2222222222222 2E-03

but I don't know why


(24 * 60 * 60) = 86400 which is a bigger number then an Integer can hold.
(cdbl(24) * 60 * 60) converts it to a double which can hold 86400

xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxx
I was thinking that declaring NewOutRefDate As Variant would take
care of any memory allocation requirements. I guess I was wrong. It
does seem strange, though. A variant is the one variable type that
is big enough to manage any of the others.


A variant will store anything, but Access creates temporary storage while
doing math functions.
24, 60, 60 are all Integer so Access creates an Integer to store the
calculation,
then fails when the result overflows the Integer.
Nov 13 '05 #6
MLH
Well, you learn something new everyday.
I thought my computer was broke.

Nov 13 '05 #7

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

Similar topics

0
2284
by: Alisher Fatykhov | last post by:
The Java grid http://24.60.235.213/Grid/
0
1336
by: Alisher Fatykhov | last post by:
Cool Applet http://24.60.235.213/Grid/
0
2127
by: Alisher Fatykhov | last post by:
Great small java grid applet http://24.60.235.213/Alisher/
3
10952
by: Ariant | last post by:
Hi - I'm trying to query my database to find the min, max and average times (in seconds, or minutes, or something) between two timestamps. I've tried using: Select avg(timestamp1 - timestamp2) from table; I get an error saying that avg() expects a number, not an interval. Is there a way (in a SQL stmt) to convert timestamps (or their
3
1568
by: Unknown | last post by:
Why does this overflow? long testmath = (898 * 360 + 30) * 24 * 60 * 60 * 1000 / 25; but if I do it this way it works.. long testmath1 = (898 * 360 + 30) long testmath2 = testmath1 * 24 * 60 * 60 * 1000 / 25; How can I get it so that it works properly in the first definition..?
2
18905
by: Diego F. | last post by:
Hello. I'm having an error in a database access. I'm just making a select query to a table and using a DataAdapter to Fill a DataSet. Sometimes it works and sometimes it results in an exception: Arithmetic operation resulted in an overflow. The query is the following: select pausa, (sysdate-fecha)*24*60*60, comentario from tableA where id = 44
3
16947
by: anupamadatta | last post by:
Hi there, I am trying to execute one Insert query using Pro C . the Insert query is as below: Prepared statement is : stmnt.len = sprintf((char*)stmnt.arr, "INSERT INTO %s (" EPTORDER_SOID_COL ", "
4
50204
by: lenygold via DBMonster.com | last post by:
I found this example in MYSQL: create table events ( id integer not null primary key , datetime_start datetime not null , datetime_end datetime not null ); insert into events values ( 1, '2006-09-09 14:00', '2006-09-09 16:00' ) ,( 2, '2006-09-10 09:00', '2006-09-10 17:00' ) ,( 3, '2006-09-11 13:30', '2006-09-11 14:45' )
15
6447
by: student4lifer | last post by:
Hello, I have 2 time fields dynamically generated in format "m/d/y H:m". Could someone show me a good function to calculate the time interval difference in minutes? I played with strtotime() but but that only gave me difference in hours and only if the times were on the same day (after wrapping with date() function). TIA
0
10648
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
10389
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
10402
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
10135
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...
0
9205
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
5554
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...
1
4339
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
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3018
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.