Welcome

Welcome, thanks to look my blog

Friday 18 December 2015

DATESERIAL FUNCTION

MS ACCESS: DATESERIAL FUNCTION

This MSAccess tutorial explains how to use the Access DateSerial function with syntax and examples.

DESCRIPTION

The Microsoft Access DateSerial function returns a date given a year, month, and day value.

SYNTAX

The syntax for the DateSerial function in MS Access is:
DateSerial ( year, month, day )

Parameters or Arguments

year
A numeric value between 100 and 9999 that represents the year value of the date.
month
A numeric value that represents the month value of the date.
day
A numeric value that represents the day value of the date.

APPLIES TO

The DateSerial function can be used in the following versions of Microsoft Access:
  • Access 2013, Access 2010, Access 2007, Access 2003, Access XP, Access 2000

EXAMPLE

Let's look at how to use the DateSerial function in MS Access:
DateSerial (2004, 6, 30)
Result: '6/30/2004'

DateSerial (2004-1, 6, 30)
Result: '6/30/2003'

DateSerial (2004, 6-2, 14)
Result: '4/14/2004'

EXAMPLE IN VBA CODE

The DateSerial function can be used in VBA code in Microsoft Access.
For example:
Dim LDate As Date

LDate = DateSerial (2004, 5, 31)
In this example, the variable called LDate would now contain the value of '5/31/2004'.

EXAMPLE IN SQL/QUERIES

You can also use the DateSerial function in a query in Microsoft Access.
For example:
Microsoft Access
In this query, we have used the DateSerial function as follows:
Expr1: DateSerial(2004,3,12)
This query will use the DateSerial function to construct a date based on 2004 as the year, 3 as the month, and 12 as the day values. The results will be displayed it in a column called Expr1. You can replace Expr1 with a column name that is more meaningful.
For example:
DateValue: DateSerial(2004,3,12)
The results would now be displayed in a column called DateValue.

sumber:http://www.techonthenet.com/access/functions/date/dateserial.php

No comments:

Post a Comment