473,387 Members | 1,516 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,387 software developers and data experts.

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 "Declarations". 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 1704
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.22222222222222E-03

but I don't know why

Nov 13 '05 #3

<le*********@natpro.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
(24 * 60 * 60) must be trying to evaluate to an integer

192 / (cdbl(24) * 60 * 60) seems to work = 2.22222222222222E-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**@packairinc.com>
wrote:

<le*********@natpro.com> wrote in message
news:11**********************@g47g2000cwa.googleg roups.com...
(24 * 60 * 60) must be trying to evaluate to an integer

192 / (cdbl(24) * 60 * 60) seems to work = 2.22222222222222E-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

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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**@NorthState.net> wrote in message
news:j8********************************@4ax.com...
On Wed, 7 Sep 2005 10:34:56 -0500, "paii, Ron" <pa**@packairinc.com>
wrote:

<le*********@natpro.com> wrote in message
news:11**********************@g47g2000cwa.googleg roups.com...
(24 * 60 * 60) must be trying to evaluate to an integer

192 / (cdbl(24) * 60 * 60) seems to work = 2.22222222222222E-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

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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
by: Alisher Fatykhov | last post by:
The Java grid http://24.60.235.213/Grid/
0
by: Alisher Fatykhov | last post by:
Cool Applet http://24.60.235.213/Grid/
0
by: Alisher Fatykhov | last post by:
Great small java grid applet http://24.60.235.213/Alisher/
3
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 -...
3
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 *...
2
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:...
3
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 ("...
4
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,...
15
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.