I have a similar problem. I have a table that consists of exhibitors' hotel
room requests over the span of 10 days of move-in, show, and move-out. The
data comes as a flat table from an online form with the number of each type
of room for each day, plus a total number of rooms field for each day. I
need to pull out of each record the total number of rooms they need on the
day they request the most rooms (e.g., if they request 10 rooms on day 4, 11
rooms on Day 5, and 8 rooms on Day 6, the query would pull 11 for peak rooms.
If they request 10 rooms on Day 4, 8 rooms on Day 5, and 4 rooms on Day 6,
the query would pull 10 rooms.) The exhibitors' requests don't all peak on
the same day or it would be easy.
If you have ten fields for the ten days... you'll find it a LOT easier if you
normalize the data, either by moving it into a normalized table or using a
"Normalizing Union Query" to string the data out so that it's one number per
record rather than one number per field.
You don't describe much about your table (primary key, fieldnames, etc.) but
you'ld need to go into the SQL window and edit something like
SELECT RequestID, (1) As TheDay, Day1 AS RoomsNeeded
FROM tablename WHERE Day1 IS NOT NULL
UNION ALL
SELECT RequestID, (2) AS TheDay, Day2 FROM tablename WHERE Day2 IS NOT NULL
UNION ALL
SELECT RequestID, (3) AS TheDay, Day3 FROM tablename WHERE Day3 IS NOT NULL
UNION ALL
<etc through the ten day fields>
This will give you the values in your spreadsheet, each in a record by itself,
with the daynumber in the field TheDay. You can then very easily use a Totals
or Top Values query to find the Max of RoomsNeeded and which day it comes.
John W. Vinson [MVP]