Ok, the first field in a form I have is called "Name". Now I want to make sure that this Name field is:
-unique
-non-Empty
and I want to verify this BEFORE I move on to the next field. Below is my pathetic attempt at doing this:
Private Sub Corporation_Name_Exit(Cancel As Integer)
Dim corpName As Boolean
corpName = IsNull([Corporation Name])
#If corpName Then
[Corporation Name].SetFocus
#End If
End Sub
What I am doing above is simply checking to see if the field isNull and if it is, SetFocus back to it, so that the user cannot move to the next one. This is inefficient and doesn't work. How can I check to see if the field entry is UNIQUE and NONEMPTY before I move to the next field? If it isn't, I want to display a little message in the status bar or maybe perhaps a little error message window. The reason I want to do this is because I am getting errors when I press "Next Entry" when the old entry doesn have the Name field filled out.
Any help is appreciated.
-unique
-non-Empty
and I want to verify this BEFORE I move on to the next field. Below is my pathetic attempt at doing this:
Private Sub Corporation_Name_Exit(Cancel As Integer)
Dim corpName As Boolean
corpName = IsNull([Corporation Name])
#If corpName Then
[Corporation Name].SetFocus
#End If
End Sub
What I am doing above is simply checking to see if the field isNull and if it is, SetFocus back to it, so that the user cannot move to the next one. This is inefficient and doesn't work. How can I check to see if the field entry is UNIQUE and NONEMPTY before I move to the next field? If it isn't, I want to display a little message in the status bar or maybe perhaps a little error message window. The reason I want to do this is because I am getting errors when I press "Next Entry" when the old entry doesn have the Name field filled out.
Any help is appreciated.