Multipel sort criteria on a form

D

Duncs

All,

I have a question...is it possible to have a form, with multiple sort
options, based on the contents of a field?

Let me explain...

I have a database where agents select an account code from a
combo...there is a possible selection of three codes. Depending on
the code selected, a query is run that retrieves certain records from
the database. These records are then displayed in a form, from which
the agents work the accounts. However, what I want to do is,
dependingf on the code that is selected, sort the data that is
displayed in a different way. So, if account code A is selected, sort
the data by debt value from lowest to highest. If account code B is
selected, sort the data by debt value highest to lowest adn by account
settlement date. If account code C is selected, the data should be
sorted the same as account code B.

Is this possible, and if so, how?

Many TIA.

Duncs
 
T

Tom van Stiphout

On Mon, 26 Jan 2009 05:38:49 -0800 (PST), Duncs

Yes. You can write code in the myCombobox_AfterUpdate event similar to
this:
select case myCombobox
case "A"
Me.OrderBy = "myDebtValue"
case "B", "C"
Me.OrderBy = "myDebtValue DESC"
case else
Debug.Assert False 'Unexpected value
end select
Me.OrderByOn = True
(of course you change myObjectNames to yours)

-Tom.
Microsoft Access MVP
 

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

Top