Last day of month

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
 
K

Ken Snell \(MVP\)

Use the 0th day of the next month:

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

John W. Vinson

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)
 
S

SoggyCashew

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top