The following table lists examples of expressions that use the Len function to calculate the length of a text value.
You can use these expressions in calculated controls (calculated control: A control that is used on a form, report, or data access page to display the result of an expression. The result is recalculated each time there is a change in any of the values on which the expression is based.) on forms, reports, and data access pages (data access page: A Web page, published from Access, that has a connection to a database. In a data access page, you can view, add to, edit, and manipulate the data stored in the database. A page can also include data from other sources, such as Excel.).
| Expression |
Description |
| =Len("Hello") |
Displays the number of characters in the string. This expression returns the value 5. |
| =Len("Hello World") |
Displays the number of characters, including spaces. This expression returns the value 11. |
| =Len([FirstName]) |
Returns the number of characters in the FirstName field. |
You can use these expressions in a calculated field in a query.
| Expression |
Description |
| MyCount: Len("Hello") |
Displays in the MyCount field the number of characters in the string "Hello." |
| MyCount: Len([FirstName]) |
Displays in the MyCount field the number of characters in the FirstName field. |