Subform accessing procedure in Main form problem

new_2_prog

Registered User.
Local time
Today, 11:57
Joined
Aug 4, 2008
Messages
58
I have a main form (Quote-4) that contains a procedure:
Public Sub AddSpecial()
Now from my subform (Quote-4 subfrm_Special) I need to access the previous procedure after TextBox1 and/or TextBox2 LostFocus - so I use the code:
Private Sub TextBox1_LostFocus()
Forms![Quote-4].AddSpecial
End Sub

Private Sub TextBox2_LostFocus()
Forms![Quote-4].AddSpecial
End Sub

It runs through the code fine off TextBox1 but then I go to TextBox2 and tab off it doesn't run through the code again, is there a reason? Do I need to reset something some how? Is there any reason it wouldn't TextBox2's code?
HELP, thanks!
 
Public Sub AddSpecial()
Dim A As Currency
If Me.SpecialOverRide = True Then Exit Sub
A = Me.Cyl_TableTrav_Qty * Me.Cyl_TableTrav_Amt
A = A + (Me.Cyl_Platten_Qty * Me.Cyl_Platten_Amt)
A = A + (Me.Cyl_Stake_Qty * Me.Cyl_Stake_Amt)
A = A + (Me.Cyl_Other_Qty * Me.Cyl_Other_Amt)
A = A + (Nz(CylQ1, 0) * Nz(CylA1, 0))
A = A + (Me.AlumPlts5_Qty * Me.AlumPlts5_Sqr * 7.5 * PurchaseItems(1, 26))
A = A + (Me.AlumPlts7_Qty * Me.AlumPlts7_Sqr * 11 * PurchaseItems(1, 26))
A = A + (Me.AlumPlts1_Qty * Me.AlumPlts1_Sqr * 14.7 * PurchaseItems(1, 26))
A = A + (Me.StepFeeder_Qty * Me.StepFeeder_Amt)
A = A + (Me.BowlFeeder_Qty * Me.BowlFeeder_Amt)
A = A + (Me.Escapements_Qty * Me.Escapements_Amt)
A = A + (Me.Sonic_Qty * Me.Sonic_Amt)
A = A + (Me.CartisianRobot_Qty * Me.CartisianRobot_Amt)
A = A + (Me.[6axisRbt-Qty] * Me.[6axisRbt-Amt])
A = A + (Me.DrillUnit_Qty * Me.DrillUnit_Amt)
A = A + (Me.PneuScrew_Qty * Me.PneuScrew_Amt)
A = A + (Me.HotMelt_Qty * Me.HotMelt_Amt)
A = A + (Me.Misc1_Qty * Me.Misc1_Amt)
A = A + (Me.Misc2_Qty * Me.Misc2_Amt)
A = A + (Me.Misc3_Qty * Me.Misc3_Amt)
A = A + (Me.Misc4_Qty * Me.Misc4_Amt)
A = A + (Nz(Me.SPQ1, 0) * Nz(Me.SPA1, 0))
A = A + (Nz(Me.SPQ2, 0) * Nz(Me.SPA2, 0))
A = A + (Nz(Me.TravQ, 0) * Nz(Me.TravA, 0))
A = A + (Nz(Me.AutoQ, 0) * Nz(Me.AutoA, 0))
'Text box that reflects the total off the subform in order to
'add to the Total on the main form
A = A + Me.subfrm_Special_Total
Me.Special = A
Me.AlumPlts5_Amt = (Me.AlumPlts5_Qty * Me.AlumPlts5_Sqr * 7.5 * PurchaseItems(1, 26))
Me.AlumPlts7_Amt = (Me.AlumPlts7_Qty * Me.AlumPlts7_Sqr * 11 * PurchaseItems(1, 26))
Me.AlumPlts1_Amt = (Me.AlumPlts1_Qty * Me.AlumPlts1_Sqr * 14.7 * PurchaseItems(1, 26))
Me.SubTotal = Me.Labor + Me.ControlsA + Me.Purchase + Me.Special
If Me.TotalOverRide = False Then
Me.Total = Me.SubTotal + (Me.SubTotal * Me.Commission) + (Me.SubTotal * Me.[MarkUp%])
End If
End Sub

Essentially its adding up all the amounts on the main and subform to calculate a main total
 

Users who are viewing this thread

Back
Top Bottom