Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing date field 1

Status
Not open for further replies.

SidLancing

Programmer
Jun 15, 2004
31
US
I have a date field named OrderDate in a form. I have this vba code to get the just the year.
Code:
Cur_YR = DatePart("yyyy", [OrderDate])
In the table the field is defined as a Date/Time Datatype and the default value is =Date()
Can anyone help with getting the year to be 04 instead of 2004


Thanks in advance.
 
Something like this?

[tt]Cur_YR = right$(DatePart("yyyy", [OrderDate]),2)[/tt]

Roy-Vidar
 
And what about this ?
Cur_YR = Format([OrderDate], "yy")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top