Access: Len Function

In Access, the Len function returns the length of the specified string.

The syntax for the Len function is:

Len ( string )

The required string argument is any valid string expression. If the argument to Len is Null, the function returns a Null.

Example

Len ("access")                         returns 6 
Len ("webcheatsheat.com")      returns 17
Len ("hello world")                   returns 11

VBA Code

Dim MyNumber As Long 
Dim MyString As String
MyString = "WebCheatSheet.com"
MyNumber = Len(MyString)

This example uses Len to return the number of characters in a string. Now the MyNumber variable would contain the value 17.

SQL query

You can also use the Asc function in a query.

SELECT Len([ItemDesired]) AS Expr1 
FROM Orders
admin

admin

Leave a Reply

Your email address will not be published.