Others

Use Date Validation Rules and Permissions in Microsoft Access VBA

Emma BrownEmma Brown Nov 25, 2026 868 views

Question details

Set a date validation rule in an Access form and allow authorized users to enter earlier dates.

Use Date Validation Rules and Permissions in Access VBA
Product
Microsoft Access
Device & OS
not provided
Scenario
An Access form normally accepts dates starting tomorrow, but certain users need permission to enter earlier dates.
Observed behavior
The desired rule restricts ordinary users while allowing an authorized exception, either for any earlier date or for a specified period.
Before you start

Open the form in Design View and confirm that its date text box is named txtDate. Decide how authorization will be checked and whether the exception allows any date or only dates within a defined period.

Solution 1Recommended

Change the Access form control's validation rule after an authorization check

Use VBA to apply the normal date restriction when the form opens and relax it for an authorized user.

The following example assumes you will implement UserHasDateOverride() to check the user's permission. A visible button or a client-side check alone is not a secure authorization mechanism.

Changing the control's rule does not remove a rule on the underlying table field. Enforce authorization and any required date limits in a trusted data layer if users can bypass the form.

1
Set the default rule

In the form's Design View, open the form's Property Sheet, select the On Load event, and choose Event Procedure. In the VBA editor, add: Private Sub Form_Load() Me.txtDate.ValidationRule = ">=Date()+1" End Sub

2
Add an authorized override

Add a command button to the form and open its On Click event procedure. After implementing your permission check, use: Private Sub cmdAllowEarlier_Click() If UserHasDateOverride() Then Me.txtDate.ValidationRule = "" Else MsgBox "You do not have permission to enter earlier dates." End If End Sub

3
Limit the exception if needed

In the button's On Click procedure, replace the empty rule with Me.txtDate.ValidationRule = ">=Date()-10" if authorized users may enter dates no earlier than 10 days before today. This rule also permits today and future dates.

4
Test both permission states

Open the form in Form View and try entering today and tomorrow before using the button. Then test the button with authorized and unauthorized users, including any date outside the permitted exception period.

Change the Access form control's validation rule after an authorization check
Check the table rule: A table-level validation rule can still reject a date even when the form control's rule is cleared. Review the field's Validation Rule property in table Design View.
Free Microsoft Office alternative

Use WPS Office for everyday documents and spreadsheets

WPS Office is a free, lightweight alternative with a familiar interface and support for common Microsoft Office formats, making it easy to move documents and spreadsheets between suites. It does not replace Microsoft Access or fix Access VBA validation rules.

Open and edit compatible Microsoft Word, Excel, and PowerPoint filesUse a familiar interface for everyday office workWork with date entries in spreadsheets alongside your Access workflowGet a free, lightweight office suite
QA img-9

Frequently Asked Questions

What does the rule >=Date()+1 allow?

It allows dates starting tomorrow and rejects today and earlier dates. Set it in the text box's Validation Rule property or assign it through VBA.

How can I allow dates from the previous 10 days?

After verifying permission, set txtDate.ValidationRule to ">=Date()-10". This also allows today and future dates.

Why is an earlier date still rejected after I clear the form rule?

The underlying table field may have its own Validation Rule. Open the table in Design View and inspect the field's properties.

Does the override button provide secure authorization by itself?

No. The example requires a separate permission check, and form-level VBA can be bypassed through other data-entry paths. Enforce sensitive permissions in a trusted data layer.