Strange. You should not get that message unless you start entering something
in the field, and backspace it out. To solve that case, press the Esc key
once to undo the field.
Once you have started entering into a required field, the data engine will
apply the rule before any of your code fires, so you can't avoid the message
with code. (You can capture the message in Form_Error, but not avoid it.)
There is another problem that arises If all these conditions are true:
- the form is based on a query that uses more than one table, and
- you get the message on the very first keystroke when you start adding a
new record, and
- you get the message even if you are not entering into this box.
In that case, the issue is that there is a Default Value set in one of the
fields from the table you are not adding records to, but Access is confused
and trying to assign the default to that field anyway. To solve the problem,
remove the Default Value from all fields in the other table (as well as from
any text boxes on your form that are bound to fields in the other table.)
A wild alternative is to set the Required property of your field to no, and
instead set the Validation Rule for the *table* to:
[pk_pe_id] Is Not Null
The Validation Rule for the table is in the Properties box in table design.
By using the rule for the table, you have record-level validation instead of
field-level validation, which delays it until Access attempts to save the
record.