Others

How to Validate Access Text Boxes with the Text Property

Nimra MalikNimra Malik Oct 29, 2026 868 views

Question details

The user needs to validate two MS Access text boxes in real-time during editing to enable or disable a form button based on valid date inputs.

How to Validate Access Text Boxes with the Text Property
Product
Microsoft Access
Device & OS
not provided
Scenario
Validating text box input in real-time before focus leaves the control to dynamically update a form button's state.
Observed behavior
During the Change event, the code reads the previous .Value instead of the newly typed text, preventing proper real-time validation and button state updates.
Before you start

Familiarize yourself with VBA code in Microsoft Access and ensure you know how to access the property sheet and event procedures for your form controls.

Solution 1Recommended

Use the .Text Property in the Change Event

Read the active control's .Text property alongside the inactive control's saved .Value to capture real-time keystrokes.

In Microsoft Access, a text box's .Value property only updates after the control loses focus. To evaluate user input character-by-character as they type, you must use the .Text property within the control's On Change event.

Since the .Text property is only accessible when a control has focus, you need to validate the active control's .Text alongside the other inactive control's saved .Value.

1
Open the Form in Design View

Right-click your Access form in the Navigation Pane and select Design View to edit the form layout.

2
Add On Change Event

Select the first date text box. In the Property Sheet, go to the Event tab, click the ellipsis (...) next to 'On Change', and choose Code Builder.

3
Write the Validation Logic

Inside the event procedure, write a VBA script that checks if the active text box's .Text and the second text box's .Value are both valid dates using the IsDate() function.

4
Toggle the Button State

If both evaluate to true, set the button's .Enabled property to True. Otherwise, set it to False.

5
Repeat for the Second Text Box

Apply the exact same logic to the second text box's On Change event, ensuring you check its .Text against the first text box's .Value.

Use the .Text Property in the Change Event
Performance Consideration: Because the On Change event fires with every keystroke, complex validation logic here might slightly impact form performance on slower systems.
Free Microsoft Office alternative

Looking for a Free Microsoft Office Alternative?

While WPS Office does not include a database management tool like Access, it is a highly capable, free alternative for Word, Excel, and PowerPoint. Enjoy a lightweight suite with excellent format compatibility and a familiar user interface.

  1. 1. Download the Installer: Visit the official WPS website and download the free WPS Office installer.
  2. 2. Install the Suite: Run the installer and follow the on-screen prompts to set up the software on your device.
  3. 3. Open Office Files: Double-click any existing Word, Excel, or PowerPoint document to open it seamlessly in WPS Office.
Fully compatible with Microsoft Office formats (.docx, .xlsx, .pptx).Lightweight software that installs quickly and runs smoothly.All-in-one suite combining documents, spreadsheets, presentations, and PDFs.Familiar user interface requiring no learning curve for Office users.
microsoft office alternative - wps office

Frequently Asked Questions

Why isn't the .Value property updating when I type in an Access text box?

In Microsoft Access, the .Value property is only committed and updated when the control loses focus or the record is saved. To capture keystrokes in real-time, you must use the .Text property during the Change event.

Can I check the .Text property of a text box that doesn't have focus?

No. Access throws an error if you try to read the .Text property of a control that does not currently have focus. You can only read the .Text of the active control.

Why use the On Change event instead of After Update?

The After Update event only triggers after the user finishes editing and moves to another control. If you want a button to enable or disable dynamically while the user is still typing, you must use the On Change event.