B
B F Cole
I'm trying to check if a user leaves a field blank, post an error message,
and then return to the field for entry. The code will go to any other
field, but not the field that I want. Here's sample code:
This is executed as an event on field exit.
If ISNULL(Me.FIELD1) Then
iAnswer = MsgBox("Product Code can not be blank...re-enter or Press ESC
to Cancel...",vbCritical)
Forms!frmForm1!FIELD1.SetFocus
End If
This code goes to the next field in the tab list instead of FIELD1. If you
substitute FIELD3, FIELD4, etc in the above, it will go to FIELD3, FIELD4,
etc..
This code also behaves in a similar manner.
If ISNULL(Me.FIELD1) Then
iAnswer = MsgBox("Product Code can not be blank...re-enter or Press ESC
to Cancel...",vbCritical)
Set ctl = Forms!frmForm1!FIELD1
DoCmd.GoToControl ctl.Name
End If
Any suggestions on how to return to FIELD1?
Thanks,
Bill
and then return to the field for entry. The code will go to any other
field, but not the field that I want. Here's sample code:
This is executed as an event on field exit.
If ISNULL(Me.FIELD1) Then
iAnswer = MsgBox("Product Code can not be blank...re-enter or Press ESC
to Cancel...",vbCritical)
Forms!frmForm1!FIELD1.SetFocus
End If
This code goes to the next field in the tab list instead of FIELD1. If you
substitute FIELD3, FIELD4, etc in the above, it will go to FIELD3, FIELD4,
etc..
This code also behaves in a similar manner.
If ISNULL(Me.FIELD1) Then
iAnswer = MsgBox("Product Code can not be blank...re-enter or Press ESC
to Cancel...",vbCritical)
Set ctl = Forms!frmForm1!FIELD1
DoCmd.GoToControl ctl.Name
End If
Any suggestions on how to return to FIELD1?
Thanks,
Bill