That is what I want just the cancel. I tried the code but when I test it
out
it s
I get an error saying "Compile Error: Method or data member not found" and
then it highlights .Nz
This is my code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Nz(txtDegenerous) + Me.Nz(txtUnfertilized) + Me.Nz(txtNo2) +
Me.Nz(txtNo1) = Me.[txtNoEmbryos] Then
Else
MsgBox "The sum is not equal."
Cancel = True
End If
End Sub
--
Thorson
fredg said:
Is there a way to do an IIf statement for text boxes on a form that if
the
sum of txtbox 4, 5, 6, and 7 do not equal the number entered in txtbox3
then
a message box pops up saying that the sum is not equal?
Thanks
IIf statement? No.
If Statement? Yes.
And then what do you wish to do after the message is closed?
Code the Form's BeforeUpdate event:
If Me.Nz(Text4) + Me.Nz(Text5) + Me.Nz(Text6) + Me.Nz(Text7) =
Me.[Text3] Then
Else
MsgBox "The sum is not equal."
Cancel = True
End If
The above will cancel the form save and return you to the form for
further entry.