Query - Date - Month Plus One?

P

Paperback Writer

This should be a simple query formulation.

The date is 11/15/2008. I need a query expression to simply show the month
and year following that date.

Examples:
11/15/2008 should show 12/2008
12/12/2008 should show 1/2009.

Thanks!
 
R

Rick Brandt

This should be a simple query formulation.

The date is 11/15/2008. I need a query expression to simply show the
month and year following that date.

Examples:
11/15/2008 should show 12/2008
12/12/2008 should show 1/2009.

Thanks!

NextMonth: Format(DateSerial(Year(Date()), Month(Date())+1,1),"mm/yyyy")
 
M

Martin

I built a table1 with a field called Date.

In a select query, used the following code to add 1 month and 1 year to the
field:Date from the table.

NewDate:
Format(DateSerial(Year([Table1]![Date])+1,Month([Table1]![Date])+1,1),"mm/yyyy")

example results:

Date NewDate
5/8/2007 06/2008
11/15/2008 12/2009
12/23/2008 01/2010

Hope this works.
 
R

Rick Brandt

NextMonth: Format(DateSerial(Year(Date()), Month(Date())+1,1),"mm/yyyy")

DOH! My example obviously always returns *next* month and year.
Martin's example is more like what you need.
 

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