 |
| Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 21st, 2010, 05:13 PM
|
|
Registered User
|
|
Join Date: Feb 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Access running summary data
I have a serial data based on Date (per day) Mon to Fri. Its easy to derive an average for the whole data but I want a running average of the past twenty days, ten days etc
Grateful for your help on how to do this
Thanks
Makace
|
|

March 2nd, 2010, 03:08 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
Do you mean like "SELECT * FROM MyData WHERE Date BETWEEN etc?" or select top 20? How are you displaying this data (form or report?) What events are triggering the view?
Do you have sample table columns and a query that works?
__________________
mmcdonal
Look it up at: http://wrox.books24x7.com
|
|

March 2nd, 2010, 03:53 PM
|
|
Registered User
|
|
Join Date: Feb 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Access running summary
mmcdonal,
Below is sample data for my query. I want to display a running display of the latest 20, 10, 5, days (records) of the Dhigh and DLow in either a report or query that is grouped from top down (if possible display in vertical graphic pattern)
Thanks for your help
Makace
Day DHigh DLow
Thur 1.41 1.40
Fri 1.42 1.41
Mon 1.42 1.42
Tue 1.42 1.40
Wed 1.41 1.40
Thur 1.41 1.39
Fri 1.40 1.39
Mon 1.39 1.39
Tue 1.40 1.39
Wed 1.40 1.39
Thur 1.39 1.37
Fri 1.37 1.36
Mon 1.37 1.36
Tue 1.38 1.37
Wed 1.38 1.37
Thur 1.38 1.36
Fri 1.37 1.35
Mon 1.36 1.36
Tue 1.38 1.36
Wed 1.38 1.36
Thur 1.37 1.35
Fri 1.36 1.35
Mon 1.37 1.36
Tue 1.37 1.35
Wed 1.36 1.35
Thur 1.36 1.35
Fri 1.37 1.35
Mon 1.37 1.35
|
|

March 3rd, 2010, 08:34 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
Hi again,
I created a table like this:
Table1
DataID = PK
DayWeek = Text
DHigh = Single
DLow = Single
Is that what you are working with? If so, I created this query to display the data for the last 5 days. I assumed that the records are created in order since there are no Date fields in your data. Therefore, I am using the PK to sort the data, like this:
Code:
SELECT TOP 5 Table1.DataID, Table1.DayWeek, Table1.DHigh, Table1.DLow
FROM Table1
ORDER BY Table1.DataID DESC;
So this data:
Table1
DataID DayWeekDHigh DLow
1 Mon 1.1 1
2 Tues 2.1 1.1
3 Weds 3.1 2.2
4 Thurs 2.5 1.8
5 Fri 2 1.75
6 Mon 2 1.4
7 Weds 1.8 1.2
8 Thurs 1.8 1.2
9 Fri 1.9 1.1
yields these results:
DataID DayWeek DHigh DLow
9 Fri 1.9 1.1
8 Thurs 1.8 1.2
7 Weds 1.8 1.2
6 Mon 2 1.4
5 Fri 2 1.75
Does that work for you? If there were dates associated with these days, the results would be more reliable.
__________________
mmcdonal
Look it up at: http://wrox.books24x7.com
|
|

March 3rd, 2010, 09:48 AM
|
|
Registered User
|
|
Join Date: Feb 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Access running summary
Hi mmcdonal'
Thanks for trying to help with my query. I have dates for the data, see below. What I want to achieve is a report or query in 'access' which selects the latest 20 or 10 etc days of the combined DHigh and DLow and arrange them in one column of descending order. Please note there are 3 colums - Date, DHigh, DLow eg the first line has date 01-Feb-10, DHigh 1.3939, DLow 1.3853
Thank you
Makace
Date DHigh DLow
01-Feb-10 1.3939 1.3853
02-Feb-10 1.3975 1.3886
03-Feb-10 1.4026 1.3886
04-Feb-10 1.3903 1.3713
05-Feb-10 1.3746 1.3585
08-Feb-10 1.3714 1.3621
09-Feb-10 1.3840 1.3650
10-Feb-10 1.3813 1.3676
11-Feb-10 1.3801 1.3595
12-Feb-10 1.3689 1.3532
15-Feb-10 1.3634 1.3578
16-Feb-10 1.3777 1.3588
17-Feb-10 1.3789 1.3586
18-Feb-10 1.3655 1.3498
19-Feb-10 1.3608 1.3454
22-Feb-10 1.3654 1.3573
23-Feb-10 1.3692 1.3497
24-Feb-10 1.3626 1.3502
25-Feb-10 1.3571 1.3451
26-Feb-10 1.3683 1.3535
01-Mar-10 1.3654 1.3461
02-Mar-10 1.3622 1.3435
|
|

March 3rd, 2010, 01:28 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
I would create the query to select top 20, or 10 etc, ordered by date DESC, and then use that query to build a report ordered by date Asc. Does that help?
__________________
mmcdonal
Look it up at: http://wrox.books24x7.com
|
|

March 3rd, 2010, 01:38 PM
|
|
Registered User
|
|
Join Date: Feb 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Access running summary
Hi again,
That sounds fine - till I see the result!
Makace
|
|
 |