A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Previous Months data



 
 
Thread Tools Display Modes
  #1  
Old July 8th, 2009, 09:53 PM posted to microsoft.public.access.queries
gm6243 via AccessMonster.com
external usenet poster
 
Posts: 22
Default Previous Months data

Hi,

I am using Access 2003 as Front end and Sql backend. I have a cross tab query
which spits sales by sales rep for month 1 to mth xx based on the date
selected in cmbox enddate. I want to restrict the data for for the past 6
mths from the date selected in the combobox enddate.

I tried using this :
Between DateAdd("m",-5,[Forms]![Utilization Reports]![EndDate]) And DateAdd
("m",0,[Forms]![Utilization Reports]![EndDate])

but for the months with 30 days, it starts the report from the 30th of the
month.

To make it clear, when I select June 30, 2009, it should give me the totals
for Jan 2009, Feb 2009 .....June 2009.

Can someone please advise at to what I am doing wrong here.

Thank you,

Gmen

--
Message posted via http://www.accessmonster.com

  #2  
Old July 9th, 2009, 04:17 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Previous Months data

Between DateAdd("m",-5,[Forms]![Utilization
Reports]![EndDate])-Day([Forms]![Utilization Reports]![EndDate])+1 AND
DateAdd("m",1,[Forms]![Utilization
Reports]![EndDate])-Day([Forms]![Utilization Reports]![EndDate])

Make sure that you want -5 or -6.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

"gm6243 via AccessMonster.com" wrote:

Hi,

I am using Access 2003 as Front end and Sql backend. I have a cross tab query
which spits sales by sales rep for month 1 to mth xx based on the date
selected in cmbox enddate. I want to restrict the data for for the past 6
mths from the date selected in the combobox enddate.

I tried using this :
Between DateAdd("m",-5,[Forms]![Utilization Reports]![EndDate]) And DateAdd
("m",0,[Forms]![Utilization Reports]![EndDate])

but for the months with 30 days, it starts the report from the 30th of the
month.

To make it clear, when I select June 30, 2009, it should give me the totals
for Jan 2009, Feb 2009 .....June 2009.

Can someone please advise at to what I am doing wrong here.

Thank you,

Gmen

--
Message posted via http://www.accessmonster.com


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:54 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.