473,503 Members | 2,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sorting data in a List Box

20 New Member
Hello,

I have a list box that I want to display data that is sorted by Date and by unit.
This is the current code that I have used but nothing seems to happen when the date text box has the date that I want sorted.

Any help would be appreciated

Thanks

Expand|Select|Wrap|Line Numbers
  1. Private Sub Optiongroup_AfterUpdate()
  2.  
  3.     Select Case Me.Optiongroup
  4.         Case 2   'Order by Date
  5.  
  6.             Me.TextBoxDate.Visible = True
  7.             Me.TextBoxUnit.Visible = False
  8.  
  9.         Case 3 'Order by Unit
  10.  
  11.             Me.TextBoxUnit.Visible = True
  12.             Me.TextBoxDate.Visible = False
  13.  
  14.         Case Else
  15.  
  16.             Me.TextBoxUnit.Visible = False
  17.             Me.TextBoxDate.Visible = False
  18.  
  19.     End Select
  20.  
  21. End Sub
  22.  
  23. Private Sub TextBoxDate_AfterUpdate()
  24.  
  25.  
  26.     Select Case Me.Optiongroup
  27.         Case 2   'Order by Date
  28.  
  29.            order = "Date"
  30.            Me!Result.RowSource = "QueryDate"
  31.            Source = "QueryDate"
  32.            Result.Requery
  33.  
  34.         Case 3 'Order by Unit
  35.  
  36.            order = "Unit"
  37.            Me!Result.RowSource = "QueryUnitNo"
  38.            Source = "QueryUnitNo"
  39.            Result.Requery
  40.  
  41.         Case Else
  42.  
  43.     End Select
  44.  
  45. End Sub
Oct 17 '07 #1
1 2075
Scott Price
1,384 Recognized Expert Top Contributor
I'm assuming that Result is the name of your list box?

In the queries that you are using for the Row Source of this list box, you need to add the sort order there... Open the query in design view, you will see these rows, from top to bottom: Field, Table, Sort, Show, Criteria, Or. The Sort criteria (Ascending or Descending) are set here.

Regards,
Scott
Oct 17 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

16
3361
by: aruna | last post by:
Given a set of integers, how to write a program in C to sort these set of integers using C, given the following conditions a. Do not use arrays b. Do not use any comparison function like if/then...
17
2766
by: John Salerno | last post by:
Hi everyone. If I have a list of tuples, and each tuple is in the form: (year, text) as in ('1995', 'This is a citation.') How can I sort the list so that they are in chronological order based...
3
1673
by: joeke3el | last post by:
Hi everyone, I have not touched Perl in the last 4 years, my books are at work and I have something here I'm struggling to figure out. From a known list of servers, I need to gather up how many...
1
3856
by: jjjoic | last post by:
Hi, I use Access 2003 to generate the back-end data for a ColdFusion report at work. The report is sorted by a column and based on the sorting, rankings are assigned to each row(i.e. the biggest...
6
1604
by: aine_canby | last post by:
hi, I have the following list - how do I sort it like this -
2
1491
by: james_027 | last post by:
hi, are there available library or pythonic algorithm for sorting a list of list depending on the index of the list inside the list of my choice? d_list = , , , ,
1
7166
KevinADC
by: KevinADC | last post by:
Introduction In part one we discussed the default sort function. In part two we will discuss more advanced techniques you can use to sort data. Some of the techniques might introduce unfamiliar...
3
7302
KevinADC
by: KevinADC | last post by:
If you are entirely unfamiliar with using Perl to sort data, read the "Sorting Data with Perl - Part One and Two" articles before reading this article. Beginning Perl coders may find this article...
2
1511
by: Jason | last post by:
Hi folks-- Basically, I have a pressing need for a combination of 5.2 "Sorting a List of Strings Case-Insensitively" & 5.3 "Sorting a List of Objects by an Attribute of the Objects" from the...
2
5309
by: ihimitsu | last post by:
Hi friends guide me to sorting java list contains multiple list objects
0
7291
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7012
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.