Abd.Y
Abd.Y

Reputation: 13

How to create a combobox with ascending/descending sort options

Hello coders and fellow knowledge seekers. Hope you are well.

I used this code in a database I am creating http://allenbrowne.com/ser-62code.html courtesy of Allen Browne(check his website he is really great). That code had exactly the filtering function that I needed. I have five columns, and that code is allowing me to filter by as many or few criteria as I want. But I have three more columns that have dates, and what I have been trying to add is the ability to filter one of the three dates columns in ascending or descending order, and add that to the group filtering. For example I want to filter the form using three columns, so from the comboxes of each column I choose: Project_Phase=Proposal and Contract=Signed and Tender_Open=Ascending, then I click the filter button and it filters

So to break it down I want a) a combobox for each of the three dates columns that has the options ascending and descending (I only need to sort one of the three because the dates in each column are sequential for each row)

b) and I want this sorting to be added to the multiple filter code I already have

It has been a bit challenging but I am sure it is "crackable". Thank you for your efforts. I attached a picture for further demonstrationenter image description here

Upvotes: 0

Views: 843

Answers (1)

Abd.Y
Abd.Y

Reputation: 13

With the help of a fellow coder called Scott in another forum I was able to solve this. This is his blog, you can find many useful things there, he is good: http://scottgem.wordpress.com

So what worked is. I created a combo called cboSortField, with the three date fields as drop list options. And created an Option Group called optSortorder with Asc/Desc selections. And I posted your code in the AfterUpdate Event of the Option Group. So first I select which date field I want to sort with from the combo, then I select Asc or Desc from the Option Group.

Description image

Upvotes: -1

Related Questions