Others

Remove Trailing Spaces from an Access Table with an Update Query

Phi Hung VoPhi Hung Vo Nov 25, 2026 868 views

Question details

The user wants to remove trailing spaces from text fields in an Access table.

Remove Trailing Spaces from an Access Table
Product
Microsoft Access
Device & OS
not provided
Scenario
Text imported from Excel or web pages contains extra spaces that can affect WHERE clause comparisons.
Observed behavior
Queries may return unexpected results when stored text values contain trailing spaces.
Before you start

Identify the table and text fields that need cleaning, and make a copy of the database before running an update query. Check whether you want to remove spaces from both ends of each value or only from the end.

Solution 1Recommended

Clean Access Text Fields with an Update Query

Use Trim to remove leading and trailing spaces from one or more stored text fields.

1
Open SQL View

Open the database in Access, select Create > Query Design, close the table selection dialog if it appears, and switch to View > SQL View.

2
Enter the update query

Enter: UPDATE [YourTable] SET [CustomerName] = Trim([CustomerName]), [ContactName] = Trim([ContactName]); Replace the table and field names with your own, and include each text field you want to clean.

3
Run the query

Select Run on the query toolbar and confirm the update when prompted. Open the table to check the cleaned values.

Clean Access Text Fields with an Update Query
Trim versus RTrim: Trim removes spaces from both ends of a value. Use RTrim instead if you need to preserve leading spaces and remove only trailing spaces.
Free Microsoft Office alternative

Clean Spreadsheet Text with WPS Office

WPS Office is a free, lightweight, easy-to-use Office alternative with a familiar interface and Microsoft Office format compatibility. Export Access data to Excel first if you want to work with it in WPS Spreadsheets; WPS does not run Access update queries.

Clean imported spreadsheet text with the TRIM formula.Open and edit Microsoft Excel XLSX and XLS files.Use a familiar spreadsheet interface for an easier transition.Work with a free, lightweight Office suite.
microsoft office alternative - wps office

Frequently Asked Questions

How do I remove only trailing spaces in Access?

In an update query, use RTrim instead of Trim, for example: UPDATE [YourTable] SET [CustomerName] = RTrim([CustomerName]);

Does Trim remove spaces between words?

No. Access Trim removes spaces from the beginning and end of a text value, not spaces between words.

Can I clean several fields in one query?

Yes. Add each field assignment to the SET clause, separated by commas, as in SET [Field1] = Trim([Field1]), [Field2] = Trim([Field2]).

Why do some imported spaces remain after using Trim?

Imported web data may contain nonbreaking spaces or other characters rather than ordinary spaces. Inspect the source values and handle those characters separately.