How to keep blank fields from entering your MS Access 2013 application

I have two tables (2-Events and 1-Conditions) that have two fields (Events and Conditions) that I can't have null fields in the table.
I have made them required fields, but some how, blanks in the data still happen.

What can I do?
cssc1Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Do you have Allow Zero Length Strings set to NO ?
If not ... this could be your issue.  ""  is a ZLS ...  but not visible, yet would meet the 'Required Field' constraint.

mx

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PatHartmanCommented:
Before you change the table definition, you will need to get rid of the bad data.  Joe's suggestion regarding ZLS is almost certainly the cause.  Keep in mind that
field1 = ""
Is different from
field1 = Null

When editing with a form, if a user uses the backspace key to "delete" characters from a control, the end result is a ZLS.

For required fields, not only do I set the Required property to true and the AllowZLS to false, but I also put edits in the FORM's BeforeUpdate event to give the user meaningful error messages.
If Me.txtSomeField & "" = "" Then
    Msgbox "Some Field is required.", vbOKOnly
    Me.txtSomeField.SetFocus
    Cancel = True
    Exit Sub
End If

Open in new window


Rather than doing separate tests for null and ZLS, you can combine the two by concatenating a ZLS to a field and then testing for ZLS.  The concatenation turns a null to a ZLS.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.