View Single Post
  #1  
Old March 6th, 2005, 01:31 AM
salsaguy
external usenet poster
 
Posts: n/a
Default Sorting a table by concatenating several fields in the same table

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...