MS Access Len() Function
The Len()
function in MS Access determines the length of a string, counting the number of characters it contains.
Len(): Definition and Usage
This simple yet useful function is frequently employed to check the length of text fields, validate data inputs, or perform string manipulations where the length of a string is a factor.
Syntax
Syntax
Len(string/varname)
Parameter Values
Parameter | Description |
---|---|
string/varname |
The string or the name of a variable whose length you want to find. This is required. |
Examples
Finding the Length of a Literal String
This example finds the length of the string "SQL Tutorial".
Syntax
SELECT Len("SQL Tutorial") AS LengthOfString;
Output
12
Finding the Length of Strings in a Column
This example shows how to get the length of each 'CustomerName' in the 'Customers' table (assuming a table named 'Customers' exists with a 'CustomerName' column).
Syntax
SELECT Len(CustomerName) AS LengthOfString
FROM Customers;
Output
LengthOfString
---------------
(Length of each CustomerName in the table)