Hi, It sounds to me like you need to rethink your table design. Averages are calculated from data. Usually they are not stored. If you need to store them they should be in a separate Weekly table linked to the Daily table. A procedure or append query can be run weekly to append the new average to the Weekly table.
Bob Peterson -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of supernetwww Sent: Monday, June 13, 2005 4:22 PM To: [EMAIL PROTECTED] Subject: [AccessDevelopers] Question about subquery... I do know how to use Macro or even Stored Procedure to solve the following question, but I think there may be a simple subquery method which can do the same job. Could anyone tell me how to update a field in current record base on last five records data. For example, I have a table which has two fields: DailyTemperature and WeeklyAverage. Among hundred records, DailyTemperature column has already filled with data, but the WeeklyAverage column is filled with zero For every five records, I will add up each value of DailyTemperature to calculate their 5 days' average, then store it in sixth record's WeeklyAverage field. Afterward the record 6th to 10th will be used for calculating the average and store in 11th record's WeeklyAverage. Then keep looping and calculate to the end of table. Thank you for any suggestion. Please zip all files prior to uploading to Files section. Yahoo! Groups Links Please zip all files prior to uploading to Files section. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AccessDevelopers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
