Remove Trailing Spaces from an Access Table with an Update Query
Question details
The user wants to remove trailing spaces from text fields in 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.
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.
Clean Access Text Fields with an Update Query
Use Trim to remove leading and trailing spaces from one or more stored text fields.
Open the database in Access, select Create > Query Design, close the table selection dialog if it appears, and switch to View > SQL View.
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.
Select Run on the query toolbar and confirm the update when prompted. Open the table to check the cleaned values.

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.

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.




