MS Access: Trim Function
The Microsoft Access Trim function removes leading and trailing spaces from a string.
Trim Function (Syntax)
The syntax for the Trim function is:
Trim ( text )
text is the string that you wish to remove spaces from.
The Trim function can be used in the following versions of Microsoft Access:
- Access 2013, Access 2010, Access 2007, Access 2003, Access XP, Access 2000
|Trim (" Tech on the Net")||would return "Tech on the Net"|
|Trim (" Alphabet ")||would return "Alphabet"|
Trim Examples (in VBA Code)
The Trim function can be used in VBA code in Microsoft Access. For example:
Dim LResult As String LResult = Trim (" Alphabet ")
The variable LResult would now contain the value of "Alphabet".
Trim Examples (in SQL/Queries)
You can also use the Trim function in a query in Microsoft Access.