Try the following. It works by using integer division on the result of the
subquery to give a value for each group of 500 rows as ordered by the text
column. It does rely on the text column having unique values to guarantee
exact grouping, however. It probably will be quite slow due to the degree of
correlation involved, but indexing the text column should help:
SELECT *,
(SELECT COUNT(*)
FROM YourTable AS T2
WHERE T2.YourTextColumn < T1.YourTextColumn)
\500 + 1 AS GroupNumber
FROM YourTable AS T1
ORDER BY YourTextColumn;
The ORDER BY clause isn't actually necessary, so if the query is being used
as the RecordSource for a report omit it and use the report's internal
sorting and grouping mechanism to group by the GroupNumber column.
If you omit the '+ 1' the group numbers will start from zero rather than one.
Ken Sheridan
Stafford, England