G
Guest
I have a subform where budget amounts and purchase order amounts are entered
for accounts. This subform was created from a query named BGTs_and_POs. I
have added three controls into the footer of this subform, one for
calculating the sum of the budget amounts, one for the sum of the purchase
order amounts, and the third, named ACCOUNT_BALANCE_SUBTOTAL, for
calculating the difference between the sums of the budget and purchase order
amounts for the account balance.
After entering a purchase order amount I need for a message box to appear
with a warning only if the balance calculates as less than or equal to zero.
I have the following as Event Code in the AfterUpdate Event for the control
where the purchase order amounts are entered. The problem seems to be that
the "If - Then" statement runs before the control named
ACCOUNT_BALANCE_SUBTOTAL has been updated, resulting with the message box
either appearing when it shouldn't, or not appearing when it should.
Private Sub PO_AMT_AfterUpdate()
Dim VarID As Variant
VarID = Me.BGTs_and_POs_ID
Me.Requery
Me.Recordset.FindFirst "BGTs_and_POs_ID =" & VarID
If Me.ACCOUNT_BALANCE_SUBTOTAL <= 0 Then
MsgBox "WARNING! THIS ACCOUNT HAS A ZERO BALANCE or IS OVERDRAWN!"
End If
End Sub
I've tried replacing the Me.Requery with
Me.ACCOUNT_BALANCE_SUBTOTAL.Requery, but that didn't work either. Also, when
using Me.Recalc instead of Me.Requery the focus is always be sent to the
first record instead of returning to the "current record". I've tried out of
the "trial and error" ideas I know and need help from the experts here.
Thanks,
RC
for accounts. This subform was created from a query named BGTs_and_POs. I
have added three controls into the footer of this subform, one for
calculating the sum of the budget amounts, one for the sum of the purchase
order amounts, and the third, named ACCOUNT_BALANCE_SUBTOTAL, for
calculating the difference between the sums of the budget and purchase order
amounts for the account balance.
After entering a purchase order amount I need for a message box to appear
with a warning only if the balance calculates as less than or equal to zero.
I have the following as Event Code in the AfterUpdate Event for the control
where the purchase order amounts are entered. The problem seems to be that
the "If - Then" statement runs before the control named
ACCOUNT_BALANCE_SUBTOTAL has been updated, resulting with the message box
either appearing when it shouldn't, or not appearing when it should.
Private Sub PO_AMT_AfterUpdate()
Dim VarID As Variant
VarID = Me.BGTs_and_POs_ID
Me.Requery
Me.Recordset.FindFirst "BGTs_and_POs_ID =" & VarID
If Me.ACCOUNT_BALANCE_SUBTOTAL <= 0 Then
MsgBox "WARNING! THIS ACCOUNT HAS A ZERO BALANCE or IS OVERDRAWN!"
End If
End Sub
I've tried replacing the Me.Requery with
Me.ACCOUNT_BALANCE_SUBTOTAL.Requery, but that didn't work either. Also, when
using Me.Recalc instead of Me.Requery the focus is always be sent to the
first record instead of returning to the "current record". I've tried out of
the "trial and error" ideas I know and need help from the experts here.
Thanks,
RC