View Single Post
  #5 (permalink)  
Old August 28th, 2008, 07:40 AM
SerranoG SerranoG is offline
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

You definitely need a query to sort them in the correct order so you pick off the correction ones to add up to 40.

However, picking them off and listing them will probably require some VBA module to cycle through the recordset created by this query. You could:

1) Write the data to a temporary table based on the sum; OR
2) Create a NEW boolean (yes/no) field into the table that is checked TRUE if the sum criteria is met as you cycle. Then in the future you need only use the records where this field is = TRUE.

I prefer the latter because you're not bloating the database with repeated data.



Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote