VBA code to call first date of the year and last date of the year

  • Thread starter Thread starter Irshad Alam
  • Start date Start date
I

Irshad Alam

I have a command button and 2 text field :

On click event I need Text1 to get the first date of the current year (like
01-01-2010) and Text2 to get end date of the current year (like 31-12-2010)

Please advice

Regards

Irshad
 
I have a command button and 2 text field :

On click event I need Text1 to get the first date of the current year (like
01-01-2010) and Text2 to get end date of the current year (like 31-12-2010)

Please advice

Regards

Irshad

You can use the DateSerial function:

DateSerial (Year(Date(),1,1) and DateSerial (Year(Date(),12,31)

Groeten,

Peter
http://access.xps350.com
 
Irshad said:
I have a command button and 2 text field :

On click event I need Text1 to get the first date of the current year
(like 01-01-2010) and Text2 to get end date of the current year (like
31-12-2010)
Text1 = #01 01#
text2 = #31 12#
should work.
Access defaults to the current year if it in not specified.

If they have to do it all the time set the defaults to the above and get rid
of the button.
 
Back
Top