UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Puzzler. get the last 12 months from end date month.    
 
   
plocke
post Nov 10 2005, 08:19 PM
Post #1

UtterAccess Veteran
Posts: 459
From: Eureka, CA



SELECT
FROM tblEvents where ((([tblEvents].[Date])>=[txtEndDate] And ([tbEvents].[Date])<=[txtEndDate]))

I have a date range specified on a report with sub reports.. the user enters start and end date,
for example.

06/26/05 to 10/25/05

one subreport returns values for this range just fine..

but on the second I want to return the last full 12 months up to the specified end month... if the end month was 10/25/05 I want the start date the query to be 12 months behind the month and year of the end date

11/01/04 to 10/25/05


how can i convert.. 06/26/05 to 11/01/04 ?
???

Anyone brave enough? = ) *dangles raw meat from a stick*
Go to the top of the page
 
+
NoahP
post Nov 10 2005, 08:28 PM
Post #2

Retired Moderator
Posts: 10,493
From: Lexington/Louisville KY USA



Try:

DateSerial(Year(txtEndDate),Month(txtenddate)-11,0)

As an aside, 'Date' is a Reserved Word and should never be used as the name of a field or control. Using any Reserved Word can cause mysterious errors that are very hard to diagnose.

Just curious, is txtEndDate a parameter or how are you entering it? (I don't see a reference to the form is why I ask.)

HTH
Noah

PS - keep the meat!
Go to the top of the page
 
+
plocke
post Nov 10 2005, 10:39 PM
Post #3

UtterAccess Veteran
Posts: 459
From: Eureka, CA



what am i gonna do with all this meat?

yea.. ultimately this query refrences report text box parameters..

thanks a lot!

oh.. and the date thing.. i know, vendor database im pulling from.. what a pain.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 23rd May 2013 - 10:38 AM