Solved

Report to display Current Month Data and Previous X Month's data.

Posted on 2006-07-24
3
278 Views
Last Modified: 2011-10-03
I am building some reports of data that is entered each month.  I need to generate reports that contain the data for this month as well as the previous X months.  I am having trouble with building the subtraction of these dates.  I have a form with 3 dropdown menus.  One for month (Jan, Feb, ...) one for Year (00, 01, 02,...), and one for Number of months (1, 2, ...).

How can I build a query off this so that when I select Feb 06 and previous 4 months a query gives me reports for:
Feb06
Jan06
Dec05
Nov05  

Is there a way to subtract dates?

Thanks!
0
Comment
Question by:busbeead
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
rockiroads earned 500 total points
ID: 17167921
You can make use of DateAdd

e.g
dateadd("m",-4,currdate)

"m" = months
-4 = back 4
currdate = based from this date

Now in your query, for your selected date that u want t check against, u can do a between
e.g.

where somedatefield between mydate and dateadd("m",-4,mydate)
0
 

Author Comment

by:busbeead
ID: 17168617
That is exactly what I was looking for.  I had been trying to build all these stupid tables to figure this out.  Thanks so much for such a quick solution!
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17170449
No probs!
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

622 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