473,795 Members | 2,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBA Overflow Error - Again

1 New Member
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.projectAlloc atedHours.Enabl ed = True Then

adjustHours = Me.projectAlloc atedHours - Me.projectTotal Hours
averagePay = Me.tempAverageP ay

' 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 3319
missinglinq
3,532 Recognized Expert Specialist
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
5606
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 access plan manager sqlra_cache_mem_please Probe:21 Database:NJIPD Package Cache Number Overflows 0x000006FAFFBF141C : 0x00000001 .... 2003-11-12-13.20.05.780000 Instance:DB2 Node:000
19
3145
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 (nested), three list views, one tree control with up to 30,000 nodes, maybe 15 comboboxes (half of which have a large recordset as rowsource), 20 or so buttons and around 30 text boxes (not to mention the images, labels, etc and around 1000 lines...
2
17527
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 "2005001" then I want to increment this by one so that new value is "2005002" and place it in the record id field for the new record on the form. I've tried using the following code but get the message "Overflow" when I run the code. Can't find on...
20
3740
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
6280
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 something;
10
1109
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 activated during the run. The equation that causes overflow uses the exp-function, but given and resulting values are not very large (and are written in double-variables anyway). So why does it seem as if there were not enough space in the buffer? And...
3
4519
by: subramanian100in | last post by:
Suppose unsigned int size = UINT_MAX; Now consider ++size; After increment operator, size value becomes zero in
3
10746
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 the case statement they work fine, but blow up with an overflow error in the case statement. The select looks like: SELECT a.acct_cd, a.crrncy_cd, a.mkt_val, c.rate,
2
686
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 message. If I then open it in design view and change the format of any total field (it doesn't seem to matter which one!), it will again run fine a couple of times. Then the error message will occur again. Can anyone please explain this and...
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9522
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10448
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
10003
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
9046
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
6784
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
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...
0
5566
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2922
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.