Others

How to Restore Microsoft Access Form Control Properties at Runtime

Algirdas JasaitisAlgirdas Jasaitis Oct 22, 2026 870 views

Question details

The user needs a way to restore the original Design view properties (such as colors and positions) of Microsoft Access form controls during runtime after they have been dynamically modified using VBA.

How to Restore Microsoft Access Form Control Properties at Runtime
Product
Microsoft Access
Device & OS
not provided
Scenario
Modifying form control formatting and positioning dynamically via VBA scripts and needing to revert the form to its original default layout without manual intervention.
Observed behavior
Access does not natively expose or remember the design-time values of modified properties while the form is actively running, making it difficult to reset them programmatically.
Before you start

Ensure you have created a backup copy of your Access database before writing and testing VBA scripts, as errors in runtime property manipulation can sometimes cause the form to behave unpredictably.

Solution 1Recommended

Store Original Values in a Metadata Table

Create a dedicated reference table to hold the default formatting values and write a VBA function to fetch and apply them when a reset is needed.

Because Access does not retain a memory of design-time formatting values once they are altered at runtime, storing these defaults externally is the most robust approach. By querying an external table, you can programmatically reapply the original properties at any time without needing to reload the form.

1
Create a metadata table

Design a new table named 'tblControlDefaults' with fields for 'ControlName' (Short Text), 'PropertyType' (Short Text, e.g., Color, Top, Left), and 'PropertyValue' (Short Text or Number).

2
Enter the default values

Manually input the original Design view values for each control you plan to modify during runtime into this new table.

3
Write the reset VBA script

In your form's VBA module, write a subroutine that opens a Recordset to query 'tblControlDefaults'. Use a loop to iterate through the records and assign the queried values back to the controls (e.g., Me.Controls(rs!ControlName).BackColor = rs!PropertyValue).

4
Trigger the reset

Assign this subroutine to the 'On Click' event of a Reset button on your form to trigger the restoration instantly.

Store Original Values in a Metadata Table
Scalability: This table-driven approach scales exceptionally well; if you add new controls in the future, you only need to add new records to the table without rewriting your VBA code.
Free Microsoft Office alternative

Discover WPS Office - Your Free Office Alternative

While complex relational database management requires tools like Microsoft Access, WPS Office offers an exceptional, free, and lightweight alternative for all your Word, Excel, and PowerPoint tasks. Enjoy a familiar interface and seamless migration without expensive subscription fees.

  1. 1. Download the Installer: Visit the official WPS Office website and click the Free Download button to get the latest version.
  2. 2. Install the Suite: Run the downloaded executable file and follow the simple on-screen instructions to install the software.
  3. 3. Open and Create: Launch WPS Office to immediately start working on your documents, spreadsheets, and presentations with full Microsoft compatibility.
Free and lightweight office suite with incredibly fast installation.Fully compatible with Microsoft Office formats including DOCX, XLSX, and PPTX.Familiar user interface that requires zero learning curve for Office users.All-in-one workspace featuring advanced PDF editing and conversion tools.
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't Microsoft Access remember original formatting properties natively?

Access optimizes runtime memory by only holding the current state of a form's properties. It relies on the saved Design view file for defaults, which is not dynamically queryable by VBA during standard execution without reloading the form.

Can I use Conditional Formatting instead of VBA to change control colors?

Yes. For straightforward rules based on field values, Access Conditional Formatting is highly recommended. It handles the logic automatically and reverts to default formats when conditions are no longer met, eliminating the need for VBA reset scripts.

Does closing an Access form via VBA discard data entered by the user?

If the form is bound to a data table, Access typically attempts to auto-save the record when closing. However, if the form uses unbound fields or you explicitly undo the record changes before executing the close command, unsaved data will be lost.