mandatory list box selection

  • Thread starter Thread starter Lukester
  • Start date Start date
L

Lukester

Hi all, I'm an access neophyte, building a database for a
small startup.
My problem is this. In a form, I want a list box (?) to
popup for a certain field, which lists the choices the
user can select to fill in that field. I don't want a
default value to be entered automatically if the user
neglects to input one. The field should start blank, and
the user should be unable to skip to the next record
without inputting something. If the user tries to exit
that record without filling that field he should get an
error message telling him what he has to do.
I don't need any detailed instructions.(I think) I have
enough resources to figure it out on my own, with just
the correct terminology to use in Access help, and
perhaps general directions if help doesn't make obvious
how to do it. I'm using access 2002 and will very soon be
using 2003. Thanks a ton in advance! -Luke
 
Lukester said:
Hi all, I'm an access neophyte, building a database for a
small startup.
My problem is this. In a form, I want a list box (?) to
popup for a certain field, which lists the choices the
user can select to fill in that field. I don't want a
default value to be entered automatically if the user
neglects to input one. The field should start blank, and
the user should be unable to skip to the next record
without inputting something. If the user tries to exit
that record without filling that field he should get an
error message telling him what he has to do.
I don't need any detailed instructions.(I think) I have
enough resources to figure it out on my own, with just
the correct terminology to use in Access help, and
perhaps general directions if help doesn't make obvious
how to do it. I'm using access 2002 and will very soon be
using 2003. Thanks a ton in advance! -Luke

The simplest and most reliable method would be to change the table's design
to make that field "Required". This will disallow the saving of any record
where the field has not been populated.

An alternative would be to test for the value in the Form's BeforeUpdate
event. You would then display a message to the user and Cancel the event
when the field has been left blank. This would force the user to either
enter a value in the field or cancel the record altogether. It's not as
reliable as the Required property because it only applies to entries made
with that form, but if the form is the only way you allow records to be
entered, it should suffice.
 
Look at the BeforeUpdate event - post back if you want more help on what to
do with it.

Is that general enough :-) ?
 
Back
Top