Sorting

  • Thread starter Thread starter Shawn
  • Start date Start date
S

Shawn

I have a form with a control button which runs a query. I
want to be able to have check boxes on the form that
decide the sorting of the query. Ex. If the box for name
is check I want the query to be sorting by name when it is
ran. Or if the box for phone number is check I want it
sorted by that field. Is there a macro i can use to do
this...SetValue?...any advice would help.

THX
 
Only way I can think of for using a macro for this would be to create
separate queries for each sorting order that you want to use. Then use
Conditions in your macro to decide, based on which checkbox on the form is
checked, which query to run.

One drawback to this may be that each query must be named differently. How
are the queries being used? To run a report? To display results on a form?

If you can provide a bit more info about how you will use the queries, we'll
see what we can do to help you out.
 
The queries are being displayed directly. They have
multiple fields that a user may want to sort by. That is
why I want a check box or pull down menu to chose which
way they want it sorted. Is this possible using SQL?
 
Easiest way to do what you want would be to go directly to VBA code, build
the SQL statement in the code (based on which checkbox(es) is/are checked on
the form, and then execute the query that you've built. Otherwise, you'd
need the macro setup that I mentioned.
 
Back
Top