Office Apps Crashing

How to Fix Microsoft Access InStr Query Errors and Crashes

Tauseeq MagsiTauseeq Magsi Nov 2, 2026 869 views

Question details

Users need to resolve unexpected failures or application crashes when executing Microsoft Access queries that use the InStr function.

How to Fix Microsoft Access InStr Query Errors and Crashes
Product
Microsoft Access
Device & OS
Windows 10
Scenario
Running queries using the InStr function without explicitly specifying the optional starting position or comparison type arguments.
Observed behavior
Microsoft Access unexpectedly crashes or produces an error during query execution, even though the exact same InStr expression works perfectly in the VBA Immediate window.
Before you start

Verify your current version of Microsoft Access by navigating to File > Account. Always ensure you have a recent backup of your database before modifying queries or repairing your Office installation.

Solution 1Recommended

Specify All Optional InStr Arguments Explicitly

Providing all four parameters, including the start position and comparison type, prevents the query engine from crashing.

In certain builds of Access for Microsoft 365, the query engine mishandles omitted optional arguments, resulting in an application crash. By manually supplying these default values, you can bypass the defect until a patch is released.

1
Open Query Design

Launch your database, right-click the problematic query in the Navigation Pane, and select 'Design View'.

2
Locate the InStr Function

Find the field or criteria using the InStr function where optional arguments were omitted.

3
Update the Syntax

Modify the expression to include all four arguments: InStr([start], [string1], [string2], [compare]). For example, rewrite InStr([FieldName], 'SearchTerm') to InStr(1, [FieldName], 'SearchTerm', 1).

4
Save and Run

Click the Save icon, then switch to 'Datasheet View' to run the query and confirm the crash no longer occurs.

Specify All Optional InStr Arguments Explicitly
VBA Consistency: While the VBA compiler handles optional parameters correctly in these specific builds, explicitly stating them in your queries ensures cross-platform stability within your database.
Free Microsoft Office alternative

Discover WPS Office for a Seamless Productivity Experience

While Microsoft Access database issues require specific troubleshooting or updates, you can streamline your everyday document, spreadsheet, and presentation tasks with WPS Office. It provides a lightweight, free alternative to Microsoft Office that ensures high compatibility and reliable performance.

  1. 1. Visit the Official Website: Go to the official WPS Office website on your computer.
  2. 2. Download the Installer: Click the 'Free Download' button to get the latest installation package.
  3. 3. Install and Launch: Run the downloaded file, follow the installation prompts, and launch WPS Office to start creating.
Fully compatible with Microsoft Word, Excel, and PowerPoint file formatsLightweight application that loads quickly and saves system resourcesFamiliar user interface requiring no learning curve for Office usersBuilt-in PDF editor and powerful toolkit for daily productivity
microsoft office alternative - wps office

Frequently Asked Questions

Why does the InStr function work in VBA but crash in an Access query?

In certain updates of Microsoft 365, a software defect causes the query engine to mishandle omitted optional arguments for the InStr function. The VBA compiler processes these optional parameters differently, which allows the VBA code to execute perfectly while the query fails.

What are the four arguments of the InStr function?

The full syntax is InStr([start], [string1], [string2], [compare]). 'Start' is the numeric starting position for the search, 'string1' is the text string being searched, 'string2' is the substring you want to find, and 'compare' sets the comparison type, such as binary (0) or textual (1).

How can I check my current Microsoft Access version?

Open Microsoft Access, click on 'File' in the top left corner, then select 'Account'. Under the 'Product Information' section on the right side, you will see your specific version and build number.

Will Microsoft release a permanent fix for this InStr query bug?

Yes, version-specific bugs causing application crashes are typically prioritized and addressed in subsequent Microsoft 365 updates. Ensure you monitor the Microsoft release notes and update your Office suite once a patch is rolled out.