Show a Warning for Blank Required Fields in Microsoft Access
Question details
The user wants Access to warn users when required fields are blank before saving a record.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A form is used to enter or edit records that contain mandatory fields.
- Observed behavior
- Access should prevent a record from being saved when required values are missing and display a warning.
Identify the form controls and their corresponding fields in the underlying table. For a custom warning, check the control names in the form's Property Sheet and ensure the controls can receive focus.
Require the fields in the underlying Access table
Use table-level validation to enforce mandatory values wherever records are entered or edited.
In the Navigation Pane, right-click the form's underlying table and select Design View.
Select each mandatory field and set Required to Yes in the Field Properties pane.
For a required text field, also set Allow Zero Length to No if users must not save an empty string.
Save the table design, then open the form and try saving a record with a required field blank. Access should prevent the save and display a validation message.

Add a custom warning to the form's Before Update event
Use a form event when you need a specific message or a validation rule that depends on multiple controls.
Work with Office documents and spreadsheets in WPS Office
WPS Office is a free, lightweight alternative for everyday documents and spreadsheets, with a familiar interface and Office format compatibility to ease migration. It does not replace Microsoft Access or configure Access database validation.

Frequently Asked Questions
How do I make an Access field mandatory without writing code?
Open the underlying table in Design View, select the field, and set Required to Yes in Field Properties. For text fields, set Allow Zero Length to No if empty strings should also be rejected.
Why should I use Before Update instead of Before Insert?
The form's Before Update event runs before a new or edited record is saved. Before Insert runs when entry of a new record begins, before the user has had a chance to complete the fields.
Can I display a custom message for a blank control?
Yes. In the form's Property Sheet, open Event > Before Update, create an event procedure, and use MsgBox to display the message. Set Cancel = True to prevent the save.
Will form validation apply to records entered directly in a table?
No. Form event code runs through that form. Set the underlying table field's Required property to enforce the rule when records are entered or edited elsewhere.




