Others

How to Remove Everything After an Ampersand in Microsoft Access

Tauseeq MagsiTauseeq Magsi Nov 3, 2026 869 views

Question details

The user wants to remove an ampersand (&) and all subsequent characters from a specific text field in a database table, while keeping records without an ampersand completely intact.

How to Remove Everything After an Ampersand in Microsoft Access
Product
Microsoft Access
Device & OS
not provided
Scenario
Cleaning and standardizing text data across records within a database table.
Observed behavior
Target records containing an ampersand need to be truncated to keep only the preceding text and trimmed of extra spaces, without returning errors on non-matching records.
Before you start

Always create a backup copy of your database table and test your logic with a Select query before running any Update query to prevent accidental data loss.

Solution 1Recommended

Use an Update Query with InStr and Trim Functions

This is the most reliable method to locate the first ampersand, extract the preceding text, and remove trailing spaces directly using the query design grid.

By combining the Left and InStr functions, you can dynamically calculate the length of the string before the ampersand. The Trim function then ensures no trailing spaces are left behind.

1
Open Query Design

Open your database in Microsoft Access, navigate to the Create tab on the ribbon, and select 'Query Design'.

2
Add the Target Table

Add the table containing the target text field (e.g., ODOS) to the query grid.

3
Change to Update Query

Click the 'Update' button in the Query Type group on the ribbon to convert your standard select query into an Update Query.

4
Set the Criteria

In the Criteria row under your target field, type `Like "*&*"`. This ensures the query only attempts to modify records that actually contain an ampersand.

5
Enter the Update Expression

In the Update To row, enter the following expression: `Trim(Left([YourFieldName], InStr([YourFieldName], "&") - 1))` (replace 'YourFieldName' with your actual field name).

6
Run the Query

Click the 'Run' button (the red exclamation mark) on the ribbon to execute the update query and apply the changes to your table.

Use an Update Query with InStr and Trim Functions
Preview Your Changes: Before clicking Run, you can click the 'View' button to switch to Datasheet View. This allows you to preview exactly which records will be affected by the criteria.
Free Microsoft Office alternative

Looking for a Lightweight and Powerful Office Suite?

While Microsoft Access handles complex relational databases, WPS Office provides a free, lightweight, and incredibly intuitive alternative for managing your spreadsheets, documents, and presentations. Enjoy seamless compatibility with Microsoft Excel, Word, and PowerPoint formats without the heavy subscription fees.

  1. 1. Visit the WPS Office Website: Navigate to the official WPS Office website to find the correct installation package for your operating system.
  2. 2. Download and Install: Click the 'Download WPS Office Free' button and run the lightweight installer.
  3. 3. Open Your Files Instantly: Launch WPS Office and open your existing Office documents with full compatibility and zero formatting loss.
Fully compatible with Microsoft Excel (.xlsx), Word (.docx), and PowerPoint (.pptx) formats.Powerful Spreadsheet data manipulation tools including Flash Fill and Text to Columns to handle text splitting.Free and lightweight alternative to heavy Microsoft Office installations.Familiar user interface makes migration seamless and effortless.
QA img-9

Frequently Asked Questions

Why do I get an 'Invalid procedure call' error when running the update query?

This error usually happens if the query attempts to process a record that does not contain an ampersand. Because the ampersand is missing, the `InStr` function returns 0. Subtracting 1 results in -1, causing the `Left` function to fail. Ensure you have added the criteria `Like "*&*"` to prevent this.

What is the difference between InStr and InStrRev in Access?

The `InStr` function searches for your specified character (the ampersand) starting from the beginning (left side) of the text string. Conversely, `InStrRev` searches starting from the end (right side). If your text contains multiple ampersands, `InStr` will split at the first occurrence, while `InStrRev` will split at the last.

Can I use the Split function directly in an Access Update query grid?

No, the `Split` function is strictly available in VBA (Visual Basic for Applications). If you attempt to enter it directly into the 'Update To' row of a Query Design grid, Access will not recognize it and will return an error. You must use the `Left` and `InStr` combination for query grids.