Form With Message Box

  • Thread starter Thread starter Rl
  • Start date Start date
R

Rl

I have a main invoice with a subform. The main form is
used to take orders. The form includes the customer
number along with the total cost of the order, etc. The
subform includes the customers account balance. For
example the customer deposits $100.00 into their account
to be used against future purchases.

If the total cost of products exceeds the total in the
customers account I would like a message box to popup.
The operator should be able to OK and continue with the
transaction. I'm not sure how to accomplish this.

Any help is appreciated.

RL
 
One possible way,

In the BeforeUpdate event of the main form, check the value of the item currently being
entered and subtract that from the current balance showing on the subform. If the result
is less than zero, you would give the user the option to cancel the entry or ok the entry.

Example:
If Me.sfmSubform.Form.txtBalance - Me.txtTotalOfCurrentItem < 0 Then
If Msgbox("Exceeds Balance", vbOkCancel + vbExclamation) = vbCancel Then
Cancel = True
Me.Undo
End If
End If
 
Back
Top