Run-Time Error '6' Overflow

K

Ken Brown

I'm in need of a suggestion/help with an error I'm getting with my Access
2007 form's calculated control field(s). I'm getting a "Run-time error '6' -
Overflow" message when I go to another field and the AfterUpdate() event
fires. Most values may contain a 0 initially until inputted or may stay as a
zero depending on what pieces of equipment are run. I've set the table
structure up and set the field numbers as Long Integers a Here is a sample of
my code. Any suggestions would be most appreciated.

Private Sub Changes()
Me.Rejects_Rough = (Me.KCP_Minor_Leakers + Me.KCP_Major_Leakers +
Me.Honsel_Minor_Leakers + Me.Honsel_Major_Leakers)
Me.Rejects_Finish = (Me.Honsel_Head_Deck_Porosity +
Me.Honsel_Water_Pump_Porosity + Me.Honsel_350_Porosity +
Me.Honsel_352_Porosity + Me.Honsel_China_Valley_Porosity +
Me.KCP_Head_Deck_Porosity + Me.KCP_Water_Pump_Porosity + Me.KCP_350_Porosity
+ Me.KCP_352_Porosity + Me.KCP_China_Valley_Porosity)
Me.Blocks_UnLoaded = (Me.KCP_Good_Parts_Finish_End +
Me.Honsel_Good_Parts_Finish_End)
Me.KCP_Scrap_Total_Supplier = (Me.KCP_Major_Leakers +
Me.KCP_Head_Deck_Porosity + Me.KCP_350_Porosity + Me.KCP_352_Porosity +
Me.KCP_China_Valley_Porosity)
Me.Honsel_Scrap_Total_Supplier = (Me.Honsel_Major_Leakers +
Me.Honsel_Head_Deck_Porosity + Me.Honsel_350_Porosity +
Me.Honsel_352_Porosity + Me.Honsel_China_Valley_Porosity)
Me.Total_Scrap = (Me.Total_Scrap_Internal + Me.Supplier_Scrap +
(Me.KCP_Major_Leakers + Me.KCP_Head_Deck_Porosity + Me.KCP_350_Porosity +
Me.KCP_352_Porosity + Me.KCP_China_Valley_Porosity) +
(Me.Honsel_Major_Leakers + Me.Honsel_Head_Deck_Porosity +
Me.Honsel_350_Porosity + Me.Honsel_352_Porosity +
Me.Honsel_China_Valley_Porosity))
Me.KCP_Scrap_Index = (Me.KCP_Scrap_Total_Supplier /
(Me.KCP_Scrap_Total_Supplier + Me.KCP_Good_Parts_Finish_End))
Me.Honsel_Scrap_Index = (Me.Honsel_Scrap_Total_Supplier /
(Me.Honsel_Scrap_Total_Supplier + Me.Honsel_Good_Parts_Finish_End))
Me.Ideal_Cycle_Time = ((60 / Me.Gross_Jobs_Per_Hour) * 60)

End Sub
Private Sub OEE()
Me.Throughput_Uptime = (Me.Honsel_Finish_End + Me.KCP_Finish_End +
Me.KCP_Head_Deck_Porosity + Me.KCP_Water_Pump_Porosity +
Me.Honsel_Head_Deck_Porosity + Me.Honsel_Water_Pump_Porosity) /
(Me.Hours_Run_Finish * Me.Gross_Jobs_Per_Hour)
Me.Rough_OEE_Availability = (((Me.Hours_Run_Rough) /
(Me.Planned_Run_Time_Rough)))
Me.Rough_Performance = ((((60 / Me.Gross_Jobs_Per_Hour) * 60) / 60 / 60) *
(Me.KCP_Operation_80 + Me.Honsel_Operation_80)) / Me.Hours_Run_Rough
Me.Rough_Quality = (Me.KCP_Good_Parts_Operation_80 +
Me.Honsel_Good_Parts_Operation_80) / (Me.Honsel_Operation_80 +
Me.KCP_Operation_80)
Me.Rough_OEE = (Me.Rough_OEE_Availability * Me.Rough_Performance *
Me.Rough_Quality)
Me.Finish_OEE_Availability = (Hours_Run_Finish / Planned_Run_Time_Finish)
Me.Finish_Performance = ((((60 / Me.Gross_Jobs_Per_Hour) * 60) / 60 / 60) *
(Me.KCP_Finish_End + Me.Honsel_Finish_End)) / Me.Hours_Run_Finish
Me.Finish_Quality = ((Me.Honsel_Finish_End) - (Me.Honsel_350_Porosity) -
(Me.Honsel_352_Porosity) - (Me.Honsel_China_Valley_Porosity) +
(Me.KCP_Finish_End) - (Me.KCP_350_Porosity) - (Me.KCP_352_Porosity) -
(Me.KCP_China_Valley_Porosity)) / ((Me.Honsel_Finish_End) +
(Me.KCP_Finish_End))
Me.Finish_OEE = (Me.Hours_Run_Finish / Me.Planned_Run_Time_Finish) *
((Me.Honsel_Good_Parts_Finish_End + Me.KCP_Good_Parts_Finish_End) /
(Me.Honsel_Finish_End + Me.KCP_Finish_End)) * (((Me.Ideal_Cycle_Time / 60 /
60) * (Me.KCP_Finish_End + Me.Honsel_Finish_End)) / Me.Hours_Run_Finish)
End Sub
Private Sub Blocks_Loaded_AfterUpdate()
Call Changes
End Sub

Private Sub Blocks_UnLoaded_AfterUpdate()
Call Changes
End Sub

Private Sub Date_Entered_AfterUpdate()
Call Changes
End Sub

Private Sub Finish_Bank_AfterUpdate()
Call Changes
End Sub

Private Sub Finish_OEE_AfterUpdate()
Call Changes
End Sub

Private Sub Finish_OEE_Availability_AfterUpdate()
Call Changes
End Sub

Private Sub Finish_Performance_AfterUpdate()
Call Changes
End Sub

Private Sub Finish_Quality_AfterUpdate()
Call Changes
End Sub

Private Sub FTC_MPTS_AfterUpdate()
Call Changes
End Sub

Private Sub Honsel_350_Porosity_AfterUpdate()
Call Changes
End Sub

Private Sub Honsel_352_Porosity_AfterUpdate()
Call Changes
End Sub

Private Sub Honsel_China_Valley_Porosity_AfterUpdate()
Call Changes
End Sub

Private Sub Honsel_Finish_End_AfterUpdate()
Call Changes
End Sub

Private Sub Honsel_Head_Deck_Porosity_AfterUpdate()
Call Changes
End Sub

Private Sub Honsel_Major_Leakers_AfterUpdate()
Call Changes
End Sub

Private Sub Honsel_Minor_Leakers_AfterUpdate()
Call Changes
End Sub

Private Sub Honsel_Operation_165_AfterUpdate()
Call Changes
End Sub

Private Sub Honsel_Operation_80_AfterUpdate()
Call Changes
End Sub

Private Sub Honsel_RAW_Castings_AfterUpdate()
Call Changes
End Sub

Private Sub Honsel_Scrap_Index_AfterUpdate()
Call Changes
End Sub

Private Sub Honsel_Scrap_Total_Supplier_AfterUpdate()
Call Changes
End Sub

Private Sub Honsel_Water_Pump_Porosity_AfterUpdate()
Call Changes
End Sub

Private Sub Hours_Run_Finish_AfterUpdate()
Call Changes
End Sub

Private Sub Hours_Run_Rough_AfterUpdate()
Call Changes
End Sub

Private Sub Ideal_Cycle_Time_AfterUpdate()
Call Changes
End Sub

Private Sub KCP_350_Porosity_AfterUpdate()
Call Changes
End Sub

Private Sub KCP_352_Porosity_AfterUpdate()
Call Changes
End Sub

Private Sub KCP_China_Valley_Porosity_AfterUpdate()
Call Changes
End Sub

Private Sub KCP_Finish_End_AfterUpdate()
Call Changes
End Sub

Private Sub KCP_Head_Deck_Porosity_AfterUpdate()
Call Changes
End Sub

Private Sub KCP_Major_Leakers_AfterUpdate()
Call Changes
End Sub

Private Sub KCP_Minor_Leakers_AfterUpdate()
Call Changes
End Sub

Private Sub KCP_Operation_165_AfterUpdate()
Call Changes
End Sub

Private Sub KCP_Operation_80_AfterUpdate()
Call Changes
End Sub

Private Sub KCP_RAW_Castings_AfterUpdate()
Call Changes
End Sub

Private Sub KCP_Scrap_Index_AfterUpdate()
Call Changes
End Sub

Private Sub KCP_Scrap_Total_Supplier_AfterUpdate()
Call Changes
End Sub

Private Sub KCP_Water_Pump_Porosity_AfterUpdate()
Call Changes
End Sub

Private Sub Planned_Run_Time_Finish_AfterUpdate()
Call Changes
End Sub
Private Sub Planned_Run_Time_Rough_AfterUpdate()
Call Changes
End Sub

Private Sub Rejects_Finish_AfterUpdate()
Call Changes
End Sub

Private Sub Rejects_Rough_AfterUpdate()
Call Changes
End Sub

Private Sub Rough_OEE_AfterUpdate()
Call OEE
End Sub

Private Sub Rough_OEE_Availability_AfterUpdate()
Call OEE
End Sub

Private Sub Rough_Performance_AfterUpdate()
Call OEE
End Sub

Private Sub Rough_Quality_AfterUpdate()
Call OEE
End Sub

Private Sub Throughput_Uptime_AfterUpdate()
Call OEE
End Sub

Private Sub Total_Scrap_AfterUpdate()
Call OEE
End Sub

Private Sub Total_Scrap_Internal_AfterUpdate()
Call OEE
End Sub
 
D

Daryl S

Ken -

You need to test for division by zero. For example, in this piece:
Me.KCP_Scrap_Index = (Me.KCP_Scrap_Total_Supplier /
(Me.KCP_Scrap_Total_Supplier + Me.KCP_Good_Parts_Finish_End))

If Me.KCP_Scrap_Total_Supplier + Me.KCP_Good_Parts_Finish_End evaulates to
zero, you will get an overflow. You should test first, and then decide what
the result should be. Try something like this:

If (Me.KCP_Scrap_Total_Supplier + Me.KCP_Good_Parts_Finish_End) = 0 Then
Me.KCP_Scrap_Index = 0 'or pick what you want to be here, maybe null?
Else
Me.KCP_Scrap_Index = (Me.KCP_Scrap_Total_Supplier /
(Me.KCP_Scrap_Total_Supplier + Me.KCP_Good_Parts_Finish_End))
End If
 
P

Peter Hibbs

Ken,

Which line does the code fail on?

I see you have some multiplications in the code, if the result of any
of those calculations could result in a number greater than 32767 then
you need to convert them to Long Integers before the calculation. See
this for more info :-

http://bytes.com/topic/access/answers/472271-overflow-error

Peter Hibbs.

On Wed, 28 Apr 2010 11:23:01 -0700, Ken Brown <Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top