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  

Year to Date Query Issue



 
 
Thread Tools Display Modes
  #1  
Old February 14th, 2007, 04:22 PM posted to microsoft.public.access.queries
Steve
external usenet poster
 
Posts: 4
Default Year to Date Query Issue

Hi all-

Thanks in advance for taking time to give me a hand.

I'm having an issue with trying to make a Year to Date function in my
query. I want it to give me the year to date rainfall totals for each
individual site along with historical data and rainfall of the current
month. I can get everything else but the YTD to work. Here's what I
have so far:

SELECT Month([ldate]) AS [Month], Year([ldate]) AS [Year],
wdata.sitename, Avg(wdata.rainfall) AS AvgRainfall,
Max(wdata.rainfall) AS [Historical Hi], Min(wdata.rainfall) AS
[Historical Lo], Max(wdata.rainfall) AS HistoricalYTD, ([YearDate])-
([HistoricalYTD]) AS Deviance, Sum(wdata.rainfall) AS HistRain,
wdata.sitecode, (SELECT Sum(wdata.rainfall) FROM wdata WHERE
wdata.sitename=[Forms]![Excel Rain]![lakeCombo] AND
Year(ldate)=Year(Date()) And Month(ldate)=Month(Date())) AS YearDate
FROM wdata, HistRain
WHERE (((wdata.ldate) Between [Forms]![Excel Rain]![StartDate] And
[Forms]![Excel Rain]![EndDate]))
GROUP BY Month([ldate]), Year([ldate]), wdata.sitename, wdata.sitecode
ORDER BY Month([ldate]), Year([ldate]);


Thanks in advance for any help any of you give.

-steve-

 




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 10:54 PM.


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