How do i change the sort order of a listbox in this instance?

papic1972

Registered User.
Local time
Today, 15:33
Joined
Apr 14, 2004
Messages
122
Hi All,

I have a form "frmLoadAllocation" that has a series of filter command buttons that filters a listbox "lstJDUnallocated" on a form "frmLoadAllocationUN".

The each cmd button has a similar OnClick event code as below, the only difference between the buttons is that the ContractID is different:

Forms!frmLoadAllocationUN.lstJDUnallocatedBD.RowSource = "SELECT * FROM qryUnallocateOrders WHERE ContractID=4"
Forms!frmLoadAllocationUN.lstJDUnallocatedBD.Requery

I'm trying to create a cmd button on "frmLoadAllocationUN" that allows me to sort my listbox "lstJDUnallocated" (in ascending or descending order) based on the Rowsource programmed in my filter command buttons.

Does anyone know how to do this?:eek:
 
Change the RowSource query in response to the buttons to include:

SORT BY somefield
or
SORT BY somefield DESC

The other part of the answer you will probably find by searching "cascading listbox"
 
This thread might also be of interest it deals with sorting a list box by clicking in the header row of the list box.
 
Hey that's cool John!! Thank you that helped heaps!!!:)
 

Users who are viewing this thread

Back
Top Bottom