last day of month

G

Guest

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.
 
G

Guest

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
 
G

Guest

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

Top