Fix Microsoft Access Crashing When Opening a Form
Question details
Users experience a Microsoft Access front end crash the first time a form is opened each day via a search form using the DoCmd.FindRecord method.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A user tries to open an Access form from a search form, moving focus to a reference field and using VBA to locate a specific record.
- Observed behavior
- The application unexpectedly crashes on the initial attempt of the day when executing the older DoCmd.FindRecord approach.
Before modifying your VBA code, ensure you have created a complete backup copy of your Access database front end to prevent any unintended data loss during debugging.
Replace DoCmd.FindRecord with a Filtered DoCmd.OpenForm
The older FindRecord method requires moving focus and can cause stability issues. Opening the form directly with a WhereCondition is more reliable and efficient.
Instead of opening the form, moving the focus, and then searching for the record, you should directly pass a filter to the form as it opens. This prevents the sequence of events that typically triggers the first-run crash.
Open your Microsoft Access database and press ALT + F11 to open the VBA Editor.
Find the command button click event or macro in your search form that currently opens the target form and uses the DoCmd.FindRecord method.
Comment out or delete the lines of code that move focus to the reference field and execute DoCmd.FindRecord.
Add the following code to open the form directly. If the Reference field is numeric, use: DoCmd.OpenForm "Accounts", WhereCondition:="Reference = " & Me.Reference
If your Reference field contains text instead of numbers, you must enclose the value in quotes. Use: DoCmd.OpenForm "Accounts", WhereCondition:="Reference = '" & Me.Reference & "'"
Decompile and Compact the Database Front End
If the form continues to crash after updating the code, the front end file might have corrupted compiled VBA code that needs to be cleared.
Looking for a more stable Office experience? Try WPS Office
While WPS Office does not include a direct replacement for MS Access databases, it provides a highly stable, lightweight, and free alternative for your Word, Excel, and PowerPoint tasks. Avoid unexpected application crashes during your daily documentation and data analysis with WPS Office.
- 1. Download the installer: Visit the official WPS Office website and click the free download button.
- 2. Install the software: Run the downloaded executable file and follow the lightweight, one-click installation process.
- 3. Open your documents: Launch WPS Office and instantly open your existing .docx, .xlsx, or .pptx files without formatting loss.

Frequently Asked Questions
Why does MS Access only crash on the first run of the day?
This typically occurs because the front-end application is loading corrupted compiled VBA code into memory for the first time, or an older method like DoCmd.FindRecord struggles to initialize form focus properly upon cold startup. Decompiling the database often resolves this.
How do I handle text fields in my VBA WhereCondition?
When passing a text string to a WhereCondition in Access VBA, you must enclose the variable in quotes. For example, you can use single quotes inside the string: WhereCondition:="Reference = '" & Me.Reference & "'".
What is the difference between DoCmd.FindRecord and DoCmd.OpenForm with a filter?
DoCmd.FindRecord mimics a user manually pressing Ctrl+F to search an already opened form, which requires shifting window focus and can trigger instability. DoCmd.OpenForm with a filter (WhereCondition) directly queries the database engine and loads only the matching record, making it significantly faster and less prone to crashing.




