[AccessD] sorting a list

Drew Wutka DWUTKA at marlow.com
Mon Apr 21 20:17:32 CDT 2003


If the data is already in a collection, you sure can sort it with a query.
Build a query that pulls the data from a collection.  I posted an example of
how to do this before.  Here's the basics.  Build a function that retrieves
the data from the collection by it's index.  Then build a simple table with
a number field.  Build a function that retrieves the count of the
collection.  Have 2 fields in the query, the first field is the field from
the number field table.  Put the Collection count as the criteria (<=).
Have that function not only return the count of the collection, but have it
check the size of the collection against the highest value in that table.
If the table has less 'numbers' then the collection, add enough records
(with consecutive numbers) to bring it up to par.  Then have the second
field in the query return the value from the collection based on the index
retrieved from the number table.  Then hide the first field and sort the
second.  Whalla!

Drew

-----Original Message-----
From: Susan Harkins [mailto:harkins at iglou.com]
Sent: Monday, April 21, 2003 8:03 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] sorting a list 


Can't use a query -- I'm using a For Each to loop through a collection to
get the list. I thought about filling a table with the list, but that seems
worst than sorting an array. Wonder which would be quicker?

Susan H.


> I'd say the easiest way is to switch it to a query, put the 'list' in a
> table, and have the query sort it! <grin>
>
> If you must stick with a list, use split to put it into array, then dump
it
> into a collection (or just resort the array).  Then rebuild the string.
Of
> course I think this is a long way of doing things!
>
> Drew
>
> -----Original Message-----
> From: Susan Harkins [mailto:harkins at iglou.com]
> Sent: Monday, April 21, 2003 7:52 PM
> To: AccessD at databaseadvisors.com
> Subject: [AccessD] sorting a list
>
>
> Anyone have an easy way to sort a list or combo control's list when
working
> with a Value List RowSourceType?
>
> Susan H.
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list