Below is a source code I am using to calculate the cost of goods for a company. But every time the user clicks enter to move forward and activate this formula, I receive a message “Runtime Error ‘6’ Overflow”. After debugging, the highlighted formula is the Me.UL Cost line shown below.
Any suggestions for a solution?
Thank you
rami
source code:
Private Sub Unit_Cost_LostFocus()
Me.Tot_Cost = Me.Unit_Cost * Me.Qty
Me.Disc_Cost = (Me.Tot_Cost) - ((Me.Tot_Cost * [Forms]![PO Header].[DISC]) / [Forms]![PO Header].[FCAMT])
Me.UL_Cost = (Me.Disc_Cost * (1 + [Forms]![PO Header].[Factor]) * [Forms]![PO Header].[RATE]) / Me.[Qty]
Me.TLCOST = Me.Disc_Cost * (1 + [Forms]![PO Header].[Factor]) * [Forms]![PO Header].[RATE]
End Sub
Any suggestions for a solution?
Thank you
rami
source code:
Private Sub Unit_Cost_LostFocus()
Me.Tot_Cost = Me.Unit_Cost * Me.Qty
Me.Disc_Cost = (Me.Tot_Cost) - ((Me.Tot_Cost * [Forms]![PO Header].[DISC]) / [Forms]![PO Header].[FCAMT])
Me.UL_Cost = (Me.Disc_Cost * (1 + [Forms]![PO Header].[Factor]) * [Forms]![PO Header].[RATE]) / Me.[Qty]
Me.TLCOST = Me.Disc_Cost * (1 + [Forms]![PO Header].[Factor]) * [Forms]![PO Header].[RATE]
End Sub