G
Guest
I have a form where a value can be entered into text box. I obtained an if
statement from this newsgroup that prevented a value being entered if it was
a duplicate of one already in the database. That code was:
In BeforeUpdate event of the DocumentNumber control on the form...
If DCount("*", "YourTableName", "DocumentNumber = " & Me.DocumentNumber &
"") > 0 Then
MsgBox "Duplicate. Try Again"
Cancel = True
End If
This code works perfectly except if the user decides that they want to leave
the text box empty, in which case a horrible error message comes up. What
code should I add to that shown above so that Access allows a value of null?
statement from this newsgroup that prevented a value being entered if it was
a duplicate of one already in the database. That code was:
In BeforeUpdate event of the DocumentNumber control on the form...
If DCount("*", "YourTableName", "DocumentNumber = " & Me.DocumentNumber &
"") > 0 Then
MsgBox "Duplicate. Try Again"
Cancel = True
End If
This code works perfectly except if the user decides that they want to leave
the text box empty, in which case a horrible error message comes up. What
code should I add to that shown above so that Access allows a value of null?