Required field in table, not responding in form

G

Guest

I have a required field in a table, but when I have this field on the form I
can save the form without getting the error that it is a required field, why?

In another form, I am creating a combo box that will need to be filled in
before the user can save... is the required field at the table level going to
follow through to a combo box or will I have to do this with code? If I do
this with code is the event "On Exit"?

Thanks, m.
 
A

Allen Browne

Let's confirm that you have a table in the Access database (not attached
from a different program), and in table design you have set the Required
property of the field to Yes.

If you do that, Access will not allow you to add any more records where the
field contains null.

Notes:
a) There may be some existing records where the field is null, if they were
created before you set the field's Required property.

b) If the field is of type Text, Memo, or Hyperlink, you also need to set
the Allow Zero Length property to No so it cannot contain a zero-length
string.

c) If you put a close button on your form, and use the Close action (in a
macro) or method (in code), you don't get any warning when you close the
form if the required field is Null. However, you don't get the record saved
either: Access just silently loses the entry. Details:
http://allenbrowne.com/bug-01.html

d) If you do want to check a field for null in code, use the BeforeUpate
event of the *form* (not controls.) This allows you to test and give a
custom message, or a warning you can allow the user to override. But it is
not necessary if you have set the Required property of the field to Yes in
table design.
 

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