last day of month

J

jer

can a query return the last day of a month on a date field
for exampy if in date field I have
Oct 29 2006
Nov 15 2006
Dec 10 2006
can a query return
Oct 31 2006
Nov 30 2006
Dec 31 2006
I know this can be done in excel but not sure in access
 
R

Rick Brandt

jer said:
can a query return the last day of a month on a date field
for exampy if in date field I have
Oct 29 2006
Nov 15 2006
Dec 10 2006
can a query return
Oct 31 2006
Nov 30 2006
Dec 31 2006
I know this can be done in excel but not sure in access

LastDay: DateSerial(Year(DateField), Month(DateField)+1,0)

With the DateSerial() function the "zeroth" of a given month equals the last day
of the prior month.
 
J

jer

Thank you
--
thanks as always for the help


Ofer Cohen said:
Try

DateSerial ( Year([DateFieldName]),Month([DateFieldName])+1,1)-1

--
Good Luck
BS"D


jer said:
can a query return the last day of a month on a date field
for exampy if in date field I have
Oct 29 2006
Nov 15 2006
Dec 10 2006
can a query return
Oct 31 2006
Nov 30 2006
Dec 31 2006
I know this can be done in excel but not sure in access
 
J

jer

thank you
--
thanks as always for the help


Rick Brandt said:
LastDay: DateSerial(Year(DateField), Month(DateField)+1,0)

With the DateSerial() function the "zeroth" of a given month equals the last day
of the prior month.
 

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

Query the same table three times 0
How to avergage colums 7
EOMONTH 1
2 dimensional date sort 2
Week starts on Friday 3
adding one more column to corss tab 1
Columns using month and year 1
Transpose 1

Top