Re: Sorting a table by concatenating several fields in the same table

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Duane Hookom (duanehookom_at_NO_SPAMhotmail.com)
Date: 03/06/05


Date: Sat, 5 Mar 2005 20:52:26 -0600

I would not rely on either the sort order of the query or the OrderBy in the
report. The more robust solution uses code like this found on Allen Browne's
web site http://members.iinet.net.au/~allenbrowne/ser-33.html.

-- 
Duane Hookom
MS Access MVP
"salsaguy" <salsaguy@discussions.microsoft.com> wrote in message 
news:94CFF452-C1B1-48A0-967B-0DBCED84DB90@microsoft.com...
>I am creating a database to store information about printed media.  For
> example, a single table with separate fields for title, author, publisher,
> citations, date of publishing, etc.  I want the user to choose what fields 
> to
> sort with, so that he can select a first field to sort by and a second 
> field
> to further sort any identical entries in the first field.  Ideally, I want 
> to
> allow the user to select up to three fields for sorting.  I would prefer 
> to
> accomplish this using VB.  I am using Access 2002.
>
> I have had no problem sorting the data with one selected field by making a
> query with the Order By statement.  But I have not been able to implement 
> the
> sorting with multiple fields.  I have an idea that I believe would allow 
> me
> to continue using the Order By statement and still let the user define up 
> to
> 3 fields (although I have not been able to implement it).  I would create 
> a
> separate field for sorting that would be left blank.  When the user 
> selects
> the fields for sorting, then those fields would be copied into the sorting
> field and concatenated.  I could then run a single query with the Order By
> statement on the sorting field and, in effect, sort with all 3 fields 
> taken
> into account.  Then after the sorting has taken place I would need to 
> erase
> the concatenated fields from the sorting field.
>
> I would be interested in any help or code.  This is my first project with
> Access, and although I do have some background in C++, I am learning the 
> VB
> and SQL as I go.  Thanks...
>
> 


Relevant Pages

  • Re: Strategy for Sorting in UI
    ... You have to do your sort in the database query using a unique value. ... So, for example, if you are sorting by "LastName" ... > How do I navigate pages in this situation? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Strategy for Sorting in UI
    ... You have to do your sort in the database query using a unique value. ... So, for example, if you are sorting by "LastName" ... > How do I navigate pages in this situation? ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Strategy for Sorting in UI
    ... You have to do your sort in the database query using a unique value. ... So, for example, if you are sorting by "LastName" ... > How do I navigate pages in this situation? ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: sorting
    ... When I sort the data using SQL, ... But this is just the sorting. ... If it were me I would query the database and bring back the ...
    (microsoft.public.vb.enterprise)
  • Re: A Fast sorting algorithm for almost sorted data
    ... far my compressor has potential but is nowhere near ready. ... It does however make heavy use of sorting. ... which I am currently calling Run sort. ... entire selected run can be added to the sorted output array. ...
    (comp.compression)