Require Field Entry based On Other Entry

  • Thread starter Thread starter PPCO
  • Start date Start date
P

PPCO

I'm trying to Require Entry in a Field on a form if another field has a
certain entry. I've tried the following code in Before Update:
If Me![Customer]="Mutual" and IsNull(Me![Returns]) Then
MsgBox "You must enter a value in Returns."
Cancel = True
[Returns].SetFocus

But it's giving me the error message:
"Block IF without End IF"

Thanks!
 
That's one of the more accurate error messages

If Me![Customer]="Mutual" and IsNull(Me![Returns]) Then
MsgBox "You must enter a value in Returns."
Cancel = True
[Returns].SetFocus
End If '<-- add this line as the error message suggests
 
LOL, sorry to waste your time! I copy and pasted from another post.
Duane Hookom said:
That's one of the more accurate error messages

If Me![Customer]="Mutual" and IsNull(Me![Returns]) Then
MsgBox "You must enter a value in Returns."
Cancel = True
[Returns].SetFocus
End If '<-- add this line as the error message suggests

--
Duane Hookom
Microsoft Access MVP


PPCO said:
I'm trying to Require Entry in a Field on a form if another field has a
certain entry. I've tried the following code in Before Update:
If Me![Customer]="Mutual" and IsNull(Me![Returns]) Then
MsgBox "You must enter a value in Returns."
Cancel = True
[Returns].SetFocus

But it's giving me the error message:
"Block IF without End IF"

Thanks!
 
Back
Top