Required Field in a Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a required field called LastName in a form. If I make this a required
field in the table the form is based on and it is left blank when inputing a
new record, Access comes up with a cryptic message box telling the user the
LastName field cannot be blank and preventing the record from be inserted in
the table.

My question is, how can I circumvent the Access message box with one of my
own design telling the user to complete the LastName field?

Kevin D.
 
Kevin said:
I have a required field called LastName in a form. If I make this a
required field in the table the form is based on and it is left blank
when inputing a new record, Access comes up with a cryptic message
box telling the user the LastName field cannot be blank and
preventing the record from be inserted in the table.

My question is, how can I circumvent the Access message box with one
of my own design telling the user to complete the LastName field?

Kevin D.

Check the field in the BeforeUpdate event of the form and set Cancel = True when
it is Null. In the same code you can display a MsgBox() with whatever text you
like.
 
Thanks Rick for your prompt response.

Kevin

Rick Brandt said:
Check the field in the BeforeUpdate event of the form and set Cancel = True when
it is Null. In the same code you can display a MsgBox() with whatever text you
like.
 
Back
Top