Sort on multiple fields

R

Ricoy-Chicago

I checked the threads and I could not find a solution to my questions. It may
seem very stupid but I cannot work it out...

I have a columnar form based on a query that sorts the data by [Last Name],
[First Name]. No problem here.
The form has also the [Date of Contact] and
Code:
 fields (among others),
the user sometimes wants to see the data sorted by: [Date of Contact], [Last
Name], [First Name] or by: [Code], [Last Name], [First Name]

I want to create a coomand button above the column titles. So if the user
clicks on the command button above [Code] the data will be sorted in the
order code, last, first.
I have tried:
Me!.OrderBy =
[TableName!].[Code],[TableName!][LastName],[TableName!].[FirstName]
But I get and error, I tried using "and" instead ofa comma but I get a
different error

Any help will be greatly appreciate it.
 
B

Bob Howard

The way I have handles this was to create an additional column in the query
to be used exclusive for the sequence. That column should be placed last
and should not have the little box checked (so it's not returned as a result
of the query).

Now to the contents of this field.....

Code a (fairly complicated) IIf statement that examines something on the
form (I suggest an option radio-button group that gives the user various
sequence choices), and based on this, creates a single data field that is a
concatenation of the various fields to be used for sorting all strung
together as a single field in the order specified by the chosen option
button value.

Within the query, the sequence should be set on this field only.

Within the form, code a OnChange event for the option button group ---
within this event, issue a requery.
 
R

Ricoy-Chicago

Thank you for your help, but... the IIF is going to be too complicated, also,
how
does it creates a single data field that is a concatenation of the various
fields to be used for sorting all strung together as a single field in the
order specified by the chosen option button value(?) lf it requeries, does
the user will have to retype the criteria requested by the original query?
The original query sorts data but also asks for certain criteria to reduced
the number of records being displayed on the form.

Any suggestions using the "OrderBy" or it will be too much? Thanx.

Bob Howard said:
The way I have handles this was to create an additional column in the query
to be used exclusive for the sequence. That column should be placed last
and should not have the little box checked (so it's not returned as a result
of the query).

Now to the contents of this field.....

Code a (fairly complicated) IIf statement that examines something on the
form (I suggest an option radio-button group that gives the user various
sequence choices), and based on this, creates a single data field that is a
concatenation of the various fields to be used for sorting all strung
together as a single field in the order specified by the chosen option
button value.

Within the query, the sequence should be set on this field only.

Within the form, code a OnChange event for the option button group ---
within this event, issue a requery.

Ricoy-Chicago said:
I checked the threads and I could not find a solution to my questions. It may
seem very stupid but I cannot work it out...

I have a columnar form based on a query that sorts the data by [Last Name],
[First Name]. No problem here.
The form has also the [Date of Contact] and
Code:
 fields (among others),
the user sometimes wants to see the data sorted by: [Date of Contact], [Last
Name], [First Name] or by: [Code], [Last Name], [First Name]

I want to create a coomand button above the column titles. So if the user
clicks on the command button above [Code] the data will be sorted in the
order code, last, first.
I have tried:
Me!.OrderBy =
[TableName!].[Code],[TableName!][LastName],[TableName!].[FirstName]
But I get and error, I tried using "and" instead ofa comma but I get a
different error

Any help will be greatly appreciate it.[/QUOTE]
[/QUOTE]
 
Top