current year

slimjen1

Registered User.
Local time
Today, 00:49
Joined
Jun 13, 2006
Messages
562
All, using access 2010. How do I display the default value of a date/time field to just the current year instead of using =date() to get the full date.
 
did this first and for some reason; it gives me 7/05/1905. I expected 8/20/2013?? If I change the field to Number it gives me the year as I want.
 
I used the format to get the year; yyyy but why does it give me 1905? Do I need to use serial in front and how because =year(serial(date())) gives me an error.
 
Got it. I had to use date() and format yyyy. Gets me 2013.
 
If you want to get the year from one of YOUR fields use:
Year(yourfield)
If you want the current year, it should b
Year(Date()) as Paul suggested.

Functions are your friend and VBA has many. EVERYONE would benefit from reading through the list periodically to refresh their memory of what is available. Use the list organized by category so you'll see all the "date" functions together and all the "financial" functions etc. The alpha list is pretty useless unless you know the function's name.

http://office.microsoft.com/en-us/access-help/access-functions-by-category-HA010131676.aspx

http://msdn.microsoft.com/en-us/library/ff604965(v=office.14).aspx
 

Users who are viewing this thread

Back
Top Bottom