linanderson
Registered User.
- Local time
- Today, 06:58
- Joined
- Jul 13, 2002
- Messages
- 17
I have the following code used on a OnClick event of a control on a form:
If IsNull(Me.ClientSurname) Then
Cancel = True
MsgBox "Mandatory. Please complete client surname", vbOKOnly + vbCritical, "Error"
Me.ClientSturname.SetFocus
End
End If
I want to ensure is that when the focus goes to the field with Null, the user cannot move to another field before completing this field. I thought 'Cancel = True' would work, but it does not.
Additionally, if this field is completed and then the data is cleared, the message is not received again. Is there a way of getting around this?
If IsNull(Me.ClientSurname) Then
Cancel = True
MsgBox "Mandatory. Please complete client surname", vbOKOnly + vbCritical, "Error"
Me.ClientSturname.SetFocus
End
End If
I want to ensure is that when the focus goes to the field with Null, the user cannot move to another field before completing this field. I thought 'Cancel = True' would work, but it does not.
Additionally, if this field is completed and then the data is cleared, the message is not received again. Is there a way of getting around this?