I enter a check amount into the main form cutCheckAmount and in a sub form I am allocating the check to the corresponding departments. On the subform I added a txbxSum I need the txbxCheckAmount to equal txbxSum before it will allow me to precede either with closing the form or entering in a new record or give me a message Allocation does not equal check amount. I have been working with different versions of this but I can not get anything to work. Any help would be appreciated.
tmat
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim cutCheckAmount As Integer
Dim txbxSum As Integer
If cutCheckAmount < txbxSum Then
MsgBox "Error! Allocation greater then Check
Amount. You will not be able to save this record
or proceed.", vbExclamation + vbOKOnly
cutAmount.SetFocus
ElseIf cutCheckAmount > txbxSum Then
MsgBox "Error! Allocation is less then Check
Amount.You will not be able to save this record or
proceed.", vbExclamation + vbOKOnly
txbxAmount.SetFocus
ElseIf cutCheckAmount = txbxSum Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End If
End Sub
tmat
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim cutCheckAmount As Integer
Dim txbxSum As Integer
If cutCheckAmount < txbxSum Then
MsgBox "Error! Allocation greater then Check
Amount. You will not be able to save this record
or proceed.", vbExclamation + vbOKOnly
cutAmount.SetFocus
ElseIf cutCheckAmount > txbxSum Then
MsgBox "Error! Allocation is less then Check
Amount.You will not be able to save this record or
proceed.", vbExclamation + vbOKOnly
txbxAmount.SetFocus
ElseIf cutCheckAmount = txbxSum Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End If
End Sub