accounting for leap years in data calculations

  • Thread starter Thread starter dc2696
  • Start date Start date
D

dc2696

I am attempting to create a form that allows for a one
year and next month timeframe but when working with a leap
year there is a problem with the first day of each month
no jumping to the next month. Any suggestions?
 
dc2696 said:
I am attempting to create a form that allows for a one
year and next month timeframe but when working with a leap
year there is a problem with the first day of each month
no jumping to the next month. Any suggestions?

How are you setting it up? If you use the correct functions for working
with Date values in Access they are all "leap year aware". If you add
months or years then leap year is accounted for. If you just add 365 days,
then it won't be.
 
I am attempting to create a form that allows for a one
year and next month timeframe but when working with a leap
year there is a problem with the first day of each month
no jumping to the next month. Any suggestions?

The Access DateAdd and DateSerial functions handle leapyears
correctly; i.e. a daterange for "next month" can be obtained using

BETWEEN DateSerial(Year(Date()), Month(Date()) + 1, 1) AND
DateSerial(Year(Date()), Month(Date()) + 2, 0)

The 0 value of Day in the dateserial function correctly returns the
last day of the previous month.
 
Back
Top