473,387 Members | 1,545 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.

VBA Overflow Error - Again

1
I have found TheScripts a very useful site, but however I cannot find an answer to a problem I am having, so I finally have to ask the question!

I am getting an Overflow error in a Function I have written.

BUT... It does not occur all the time.

If I call the Function from the "After Update" event for a checkbox, it works as intended, how ever if I call the Function from the "On Load" event of the Form, testing to see whether the checkbox's value is True I get the Overflow Error.

To confirm this, I set a break point below where I was getting the error. If called via the "After Update" event, the variable has the right value, but if it is called from the "On Load" event that variable holds 0.

This is the code snippet that is causing the problem:

Dim adjustHours As Integer
Dim averagePay As Currency

If Me.projectAllocatedHours.Enabled = True Then

adjustHours = Me.projectAllocatedHours - Me.projectTotalHours
averagePay = Me.tempAveragePay

' The above line is the one causing grief
...

End If

From what I have read, the definition of an overflow error is "Overflow means the number is too large for the data type."

as this works one way, and not the other it has me stumped.

Thanks in advance for your help.

Zane
Mar 14 '07 #1
1 3296
missinglinq
3,532 Expert 2GB
It would probably help us to help you if you would post the code for the function that you're calling! I'm also a little confused as to why you'd call a function in the Form_Load event to check to see if a checkbox's value was True! The function would only be checking this for the first record in the form, ignoring any other records. A more appropriate place would probably be in the Form_Current event.
Mar 14 '07 #2

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

Similar topics

1
by: xixi | last post by:
i am using db2 udb v8.1 on win 64 bit, i found this on my db2diag.log 2003-11-12-13.20.05.550001 Instance:DB2 Node:000 PID:1840(db2syscs.exe) TID:3068 Appid:AC100453.G761.00F8D15749BE...
19
by: Jim | last post by:
I have spent the past few weeks designing a database for my company. The problem is I have started running into what I believe are stack overflow problems. There are two tab controls on the form...
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...
20
by: Bronek Kozicki | last post by:
Hi Please try this code. I think that it's perfectly legal. However when compiled under MSVC71 stack overflow happens in first line of main, thus second line is never executed. B.
25
by: junky_fellow | last post by:
Is there any way by which the overflow during addition of two integers may be detected ? eg. suppose we have three unsigned integers, a ,b, c. we are doing a check like if ((a +b) > c) do...
10
by: Parachute | last post by:
Using Borland Builder 6, I get numerical overflow when running a small programme without CodeGuard ("exp: OVERFLOW error"). The programme does not give any error messages when CodeGuard is...
3
by: subramanian100in | last post by:
Suppose unsigned int size = UINT_MAX; Now consider ++size; After increment operator, size value becomes zero in
3
by: jer006 | last post by:
Hi I am writing a select statement that has an arithmetic function inside a case statement that uses logic to decide whether to divide or multiply and when I run the arithmetic statements outside...
2
by: jgscott3 | last post by:
I have a query that simply totals a number of fields from a linked table. If I run it several times, it works fine for a couple of runs and then inexplicably returns a numeric field overflow error...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.