Use Date Validation Rules and Permissions in Microsoft Access VBA
Question details
Set a date validation rule in an Access form and allow authorized users to enter earlier dates.

- 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.
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.
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.
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
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
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.
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.

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.

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.




