Solved

calculate period based on a date (invoice date)

Posted on 2012-03-23
6
398 Views
Last Modified: 2012-03-23
I would like to know if there is a function to calculates the month and the year for you based on a date in this format: "mm/dd/yyyy". The month to derive should be the month of the invoice date -1. For example if the invoice date is 01/10/2012 then the period should show: December, 2011. Another example: when the invoice date is 12/12/2011 then period should be November, 2011, etc...

Any help is most appreciated.
0
Comment
Question by:BauwensER
  • 2
  • 2
  • 2
6 Comments
 
LVL 18

Expert Comment

by:Cluskitt
ID: 37757232
If you just want the month, you can use:
Month(Dateadd(month,-1,InvoiceDate))
You can then format it any way you want.
You can also use (in VBA anyway):
Format(Dateadd(month,-1,InvoiceDate),"MMMM")
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37757234
Try this:

Format(DateAdd(YourDate,"m", -1), "mmmm, yyyy")
0
 
LVL 18

Expert Comment

by:Cluskitt
ID: 37757238
To also show year, you can use the format with "MMMM, yyyy"
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 11

Accepted Solution

by:
Runrigger earned 500 total points
ID: 37757243
try something like this;

Format(DateAdd("m",-1,[date]),"Mmmm YYYY")
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37757259
I got the DateAdd arguments backwards in my comment.

The syntax, as the others have is:

DateAdd(Interval, Number,Date)
0
 
LVL 11

Expert Comment

by:Runrigger
ID: 37757276
thank you very much
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question