update query or layered query,using counts

J

JustALittleHelp

i have data that i sort via query by 2 fields: region then by city.
i need to update (or report) a 3rd sort field, [Group], so that
- when regional record count is greater than 30, a number of groups is
determined,
-and then the total number of regional records is divided evenly and
assigned a group number.

or in (broken) query language:
-IIf(Count([Region]) > 30,
-[NoGroups]=Count([Region])/30 (no. of groups in region),
-[NoRecordsInGroup]=Count([Region])/[NoGroups] (equalizing record count
per group),
-Update (obeying existing sort orders)
Set [Group] for first [NoRecordsInGroup]=1,
Set [Group[ for 2nd [NoRecordsInGroup]=2,
and so on up to [NoRecordsInGroup]=x (where x=[NoGroups]
- Else [Group]=[Region] & "Group " & "1"

I'm not at all sure how this query(s) should be constructed. I welcome any
suggestions. Thanks for any assistance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top