Required Field in a Form

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.
 
R

Rick Brandt

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.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top