Last day of month

  • Thread starter Thread starter SoggyCashew
  • Start date Start date
S

SoggyCashew

Hello I have a query that has two fields "CurrentYear" and "CurrentMonth" I
needed to find the lst day of the current month. I tried example but gives
wrong answer. Thanks!

CurrentDay: DateSerial(Year([CurrentYear]),Month([CurrentMonth])+1,1)-1
 
Use the 0th day of the next month:

CurrentDay: DateSerial(Year([CurrentYear]),Month([CurrentMonth])+1,0)
 
Hello I have a query that has two fields "CurrentYear" and "CurrentMonth" I
needed to find the lst day of the current month. I tried example but gives
wrong answer. Thanks!

CurrentDay: DateSerial(Year([CurrentYear]),Month([CurrentMonth])+1,1)-1

What are the datatypes and contents of the CurrentYear and CurrentMonth
fields? If they're dates, the above should work; if they're integers like 2008
and 8, try

DateSerial([CurrentYear], [CurrentMonth] + 1, 0)
 
John they are like 8 for the month and 2008 for the year. Thanks!


--
Thanks,
Chad


John W. Vinson said:
Hello I have a query that has two fields "CurrentYear" and "CurrentMonth" I
needed to find the lst day of the current month. I tried example but gives
wrong answer. Thanks!

CurrentDay: DateSerial(Year([CurrentYear]),Month([CurrentMonth])+1,1)-1

What are the datatypes and contents of the CurrentYear and CurrentMonth
fields? If they're dates, the above should work; if they're integers like 2008
and 8, try

DateSerial([CurrentYear], [CurrentMonth] + 1, 0)
 
Back
Top