MS Access Trim() Function

The Trim() function in MS Access is used to remove leading and trailing spaces from a string. This is a very common operation for cleaning up text data and ensuring data consistency.



Trim(): Definition and Usage

Extra whitespace (spaces at the beginning or end of a string) can cause problems in database operations and applications. Trim() is designed to efficiently remove this extra whitespace, leaving you with just the core string data. It only removes spaces from the beginning and end; spaces within the string are left unchanged.

Syntax

Syntax

Trim(string)
      

Parameter Values

Parameter Description
string The string from which you want to remove leading and trailing spaces. This is required.

Example

Removing Leading and Trailing Spaces

This example demonstrates removing spaces from the beginning and end of the string " SQL Tutorial ".

Syntax

SELECT Trim("   SQL Tutorial   ") AS TrimmedString;
      
Output

SQL Tutorial