Form With Message Box

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
 
W

Wayne Morgan

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
 

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