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: MonthName Function

Print

In Access, the MonthName function returns a string containing the specified month.

The syntax for the MonthName function is:

MonthName ( month [, abbreviate] )

The required month argument is a value from 1 to 12, representing the month. The abbreviate argument is optional. It accepts a boolean value, that indicates if the month name is to be abbreviated. If omitted, the default is False, which means that the month name is not abbreviated.

Examples

MonthName (5)               returns 'May'
MonthName (5,False)       returns 'May'
MonthName (1,True)        returns 'May'

VBA Code

Dim MyMonth As Integer 
MyMonth = MonthName(3,False)

This example uses the MonthName function to obtain the months name from a specified month.  Now the MyMonth variable would contain the value of 'March'.

SQL query

You can also use the MonthName function in a query.

SELECT MonthName(1,True) AS Expr1
FROM Orders

Note

You cannot test this function online. It works in Access only.




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.