This doesn't work because "SEX" is a literal string, so this will never be
null. Assuming SEX is the name of the control on the form then you should
omit the quotes:
If IsNull(SEX) Then
Alternatively you could use Steve's solution which gets away from having to
write any code at all. And because the rule is at the table definition level
it can never be broken, whereas with my offered solution you have to remember
to guard against possible null entry every time you include this field on a
different form.
The reason I instictively came up with the solution that I did is that I
normally use unbound forms. This can give a safer level of control over data
vaildation before writing back to live tables. If you were using this
approach, you would not use the form's BeforeUpdate event. Instead there
would be a 'Save' button that the user would click, and any final validation
would be in this button's Click event code (you might also have validation on
individual controls' AfterUpdate or BeforeUpdate events). Anyway, the whole
bound/unbound question is probably an issue too far for this discussion!
Hope you get something to useful out of all this.
Jon.