B
Bonnie
Hi, any help appreciated. I am trying to validate data
that is keyed in a form. I have a form that opens first
to collect batch information that then opens the data
entry form. Here's the code I have been working with:
Private Sub Text96_BeforeUpdate(Cancel As Integer)
If IsNull(Forms![Liens]![Text96]) And Forms![batch
info]![Text7] = "JS" Then
If CStr(Forms![batch info]![Text7]) = "JS" Or CStr
(Forms![batch info]![Text7]) = "PL" Then
DoCmd.Beep
MsgBox "Requires a release date!",
vbExclamation, "Release Date"
Cancel = True
End If
End If
If CStr(Forms![batch info]![Text7]) <> "JS" Or
Not IsNull(Forms![Liens]![Text96]) And CStr(Forms![batch
info]![Text7]) <> "PL" Then
DoCmd.Beep
MsgBox "NO release date required!? Hit
Escape.", vbExclamation, "Release Date"
Cancel = True
End If
End If
End Sub
I've tried the conditions in the immediate window and get
the expected answer (True or False) but they don't work
from the form. Any ideas? The conditions are too
complicated to put into the validation property. I've
tried all kinds of syntax and constructs on the IF THEN
ELSE.
Thanks.
that is keyed in a form. I have a form that opens first
to collect batch information that then opens the data
entry form. Here's the code I have been working with:
Private Sub Text96_BeforeUpdate(Cancel As Integer)
If IsNull(Forms![Liens]![Text96]) And Forms![batch
info]![Text7] = "JS" Then
If CStr(Forms![batch info]![Text7]) = "JS" Or CStr
(Forms![batch info]![Text7]) = "PL" Then
DoCmd.Beep
MsgBox "Requires a release date!",
vbExclamation, "Release Date"
Cancel = True
End If
End If
If CStr(Forms![batch info]![Text7]) <> "JS" Or
Not IsNull(Forms![Liens]![Text96]) And CStr(Forms![batch
info]![Text7]) <> "PL" Then
DoCmd.Beep
MsgBox "NO release date required!? Hit
Escape.", vbExclamation, "Release Date"
Cancel = True
End If
End If
End Sub
I've tried the conditions in the immediate window and get
the expected answer (True or False) but they don't work
from the form. Any ideas? The conditions are too
complicated to put into the validation property. I've
tried all kinds of syntax and constructs on the IF THEN
ELSE.
Thanks.