Home page
 
 Home 
 ASP 
 PHP 
 SQL 
 HTML 
 JavaScript 
 Search 
 Contact 
 
Search
or browse popular tags
Access Functions
Subscription

Sign up for the free email newsletter for new tips, tutorials and more. Enter your email address below, and then click the button.

Privacy Policy

RSS Twitter

Access: Right Function

Print

In Access, the Right function returns the rightmost n characters of a string.

The syntax for the Right function is:

Right( string )

The argument string can be any string expression. However, if string contains Null, Null is returned. The argument length is a Long expression indicating how many characters to return. It must be between 0 and approximately 65,535, inclusive. If length is 0, the return value is a zero-length string. If length is greater than or equal to the number of characters in string, the entire string is returned. To find the number of characters in string, use Len(string).

Example

Right ("WebCheatSheet",11)       returns "CheatSheet"
Right("Articles", 15)                   returns "articles"

VBA Code

Dim AnyString, MyStr
AnyString = "Test string"
MyStr = Right(AnyString, 6)

This example uses the Right function to return a specified number of characters from the right side of a string. Now the MyStr variable would contain the value "string

SQL query

You can also use the Right function in a query.

SELECT Right([ItemDesired],3) AS Expr1
FROM Orders


If you'd like to see how it works, enter SQL statement and press Execute
 




Tags:

Add To: Add to dzone dzone | Digg this digg | Add to del.icio.us del.icio.us | Stumble it stumbleupon

  • Comments





Copyright © 2005-2014             www.WebCheatSheet.com All Rights Reserved.