Hi,
I have the code to ensure that if a purchase is made whereby the amount required exceeds the number in stock, then an error message appears to tell the user. The following code presents the error message and also deletes the purchase that the user has just attempted:
Is there anyway to avoid the 'you are about to delete one record...' pop-up box that accompanies the delete?
Help much appreciated, my workmates are rather fussy I'm afraid!
red.
I have the code to ensure that if a purchase is made whereby the amount required exceeds the number in stock, then an error message appears to tell the user. The following code presents the error message and also deletes the purchase that the user has just attempted:
Code:
Private Sub TotalPrice_Exit(Cancel As Integer)
'calculate the TotalPrice
TotalPrice = QuantityPurchased * Forms![frmStock].Price
If Forms![frmStock].QuantityRemaining > Forms![frmPurchase].QuantityPurchased Then
'subtract this amount from QuantityRemaining on frmStock
Forms![frmStock].QuantityRemaining = Forms![frmStock].QuantityRemaining - QuantityPurchased
Else
Dim LResponse As Integer
LResponse = MsgBox("Cannot Purchase - Insufficient Stock Levels", vbExclamation)
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
End If
End Sub
Is there anyway to avoid the 'you are about to delete one record...' pop-up box that accompanies the delete?
Help much appreciated, my workmates are rather fussy I'm afraid!

red.