Offering a sorting choice

  • Thread starter Thread starter Linda
  • Start date Start date
L

Linda

I am attempting to make it easy for users to open a query by offering two
choices on sorting, by either Grant or Unit ID. I've created a form to do
this, but I'm not sure of the language I need to make this work. I already
have a parameter query set up that asks for the State, but this OR business
is confusing.

Any help is appreciated!

Linda
 
Open your query in design view and add an Order By clause something like this:

ORDER BY IIf([Enter Sort]="Grant",[Grant],[UnitID]);

It will prompt for a sort order and then sort on what the user entered.

My preferred way; however, is to use a combo box on a form with the valid
selections and use that in the query:
ORDER BY Forms!MyFormName!MyComboName;
 
Would I put this clause in the Order By area in the Properties box? If so,
it didn't prompt for the sort order.

Linda

Klatuu said:
Open your query in design view and add an Order By clause something like this:

ORDER BY IIf([Enter Sort]="Grant",[Grant],[UnitID]);

It will prompt for a sort order and then sort on what the user entered.

My preferred way; however, is to use a combo box on a form with the valid
selections and use that in the query:
ORDER BY Forms!MyFormName!MyComboName;
--
Dave Hargis, Microsoft Access MVP


Linda said:
I am attempting to make it easy for users to open a query by offering two
choices on sorting, by either Grant or Unit ID. I've created a form to do
this, but I'm not sure of the language I need to make this work. I already
have a parameter query set up that asks for the State, but this OR business
is confusing.

Any help is appreciated!

Linda
 
The best way to do this is open the query in design view, then switch to SQL
view, and add the code to the end of the sql statement.
--
Dave Hargis, Microsoft Access MVP


Linda said:
Would I put this clause in the Order By area in the Properties box? If so,
it didn't prompt for the sort order.

Linda

Klatuu said:
Open your query in design view and add an Order By clause something like this:

ORDER BY IIf([Enter Sort]="Grant",[Grant],[UnitID]);

It will prompt for a sort order and then sort on what the user entered.

My preferred way; however, is to use a combo box on a form with the valid
selections and use that in the query:
ORDER BY Forms!MyFormName!MyComboName;
--
Dave Hargis, Microsoft Access MVP


Linda said:
I am attempting to make it easy for users to open a query by offering two
choices on sorting, by either Grant or Unit ID. I've created a form to do
this, but I'm not sure of the language I need to make this work. I already
have a parameter query set up that asks for the State, but this OR business
is confusing.

Any help is appreciated!

Linda
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top