473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Query average by date and time in MS Access

Hello,

I have two tables, WindVector (wind data) and DOH_FC88to07 (water quality samples). The WindVector table has the following fields:

Date (short date)
Time (short time)
WindSpeed
WindDir
WindDirRads
V
U

The DOH_FC88to07 table has the following fields:

Station
Date (short date)
Time (short time)
FC

I am able to successfully calculate the average wind speed and direction for a given (user defined) date and time range (see SQL below)

SELECT Avg(WindVector.V) AS VAvg, Avg(WindVector.U) AS UAvg, Sqr(([VAvg]^2)+([UAvg]^2)) AS R, atan2((-[VAvg]),(-[UAvg]))*57.29577951 AS Wdir
FROM WindVector
WHERE (((WindVector.Time) Between [Forms]![frmParameters]![WindStartTime] And [Forms]![frmParameters]![WindEndTime]) AND ((WindVector.DATE)=[Forms]![frmParameters]![SampleDate]));


What I'd like to do now is calculate the average wind speed and direction for a user defined time period (e.g. four hours) preceding a water sampling event. There are multiple sampling events on the same day but at different times.

Here's what I've tried thus far...but the query doesn't return any results.

SELECT DOH_FC88to07.Station, DOH_FC88to07.Date, DOH_FC88to07.Time, DOH_FC88to07.FC, Avg(windvector.V) AS VAvg, Avg(windvector.U) AS UAvg, Sqr(([VAvg]^2)+([UAvg]^2)) AS R, atan2((-[VAvg]),(-[UAvg]))*57.29577951 AS Wdir
FROM windvector, DOH_FC88to07
WHERE (((windvector.DATE)=[DOH_FC88to07]![Date]) AND ((windvector.Time) Between DateAdd("h",-4,[DOH_FC88to07].[time]) And [DOH_FC88to07].[Time]))
GROUP BY DOH_FC88to07.Station, DOH_FC88to07.Date, DOH_FC88to07.Time, DOH_FC88to07.FC;


Any help would be greatly appreciated (this is fairly urgent)

MS Access 2003
Windows XP Pro Version 2002 Service Pack 2
Jun 19 '07 #1
1 3511
MMcCarthy
14,534 Expert Mod 8TB
You need a relationship between WindVector and DOH_FC88to07 other than Date and Time. Have a look at this tutorial on Database Normalisation.
Jun 20 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jeff Blee | last post by:
I hope someone can help me get this graph outputing in proper order. After help from Tom, I got a graph to display output from the previous 12 months and include the average of that output all in...
0
by: David | last post by:
This might be a report question but I think it is more a query issue than a report. I am a novice at bothAccess reporting and queries and have been struggling to build the following. (Note using...
8
by: Adam Louis | last post by:
I would like help resolving this problem. I'm a novice who's been hired to query a hospital database and extract useful information, available to me only in a dynamically generated, downloadable...
1
by: Simon Bailey | last post by:
I currently have a query calculating the gap in days between two dates. The fields being "DateLookedAt" and "DateResolved" plus the calculated field "TimeTaken". I am looking to add another...
3
by: Pea | last post by:
Is it possible to get the average in a query where I have multiple criteria? Here's an abbreviated example of the query in design view: Fields: USERID DATE TIME ID_TYPE...
14
by: Tina | last post by:
My employer tracks productivity/performance of clinicians (how much they bill) each week, its averages for the month, and the 6 months. These averages are compared to their expected productivity....
1
by: flumpuk | last post by:
Hi My job currently requires me to enter data from 300+ forms a month. The system which we used in Excel was slow , and theprevious guy had three workbooks for this job . I have created...
1
by: Monroeski | last post by:
I am using Access 2003. I am setting up a form where a user selects a Clinic or Ward, beginning date, and ending date, and the form outputs the averages of a few fields based on that criteria. I...
3
by: PtotheC | last post by:
I have a problem that I need to solve in MS Access 2000. I know how to do this in Excel. However this needs to be in Access due to a customer’s requirement. I have a list of events and what the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.