|
 |
access thread: Data order
Message #1 by "Andrew Payne" <andrewpayne.plastics@b...> on Mon, 27 May 2002 15:46:10
|
|
I have a form that displays data from a table, the data is always
displayed in ascending order, does anyone know how i could display the
data in descending order.
Thanks
Andrew
Message #2 by joe.dunn@c... on Mon, 27 May 2002 15:43:09 +0000
|
|
Go to table design, find the field indexed, click on the index symbol (the
lightning flash) and go to the line with the relevant field name.
The 3rd column (sort order) should show ascending - change to descending!
"Andrew Payne"
<andrewpayne.plastics@b... To: "Access" <access@p...>
ernet.com> cc:
Subject: [access] Data order
27/05/2002 15:46
Please respond to "Access"
I have a form that displays data from a table, the data is always
displayed in ascending order, does anyone know how i could display the
data in descending order.
Thanks
Andrew
*************************************************************************
This e-mail may contain confidential information or be privileged. It is intended to be read and used only by the named
recipient(s). If you are not the intended recipient(s) please notify us immediately so that we can make arrangements for its return:
you should not disclose the contents of this e-mail to any other person, or take any copies. Unless stated otherwise by an
authorised individual, nothing contained in this e-mail is intended to create binding legal obligations between us and opinions
expressed are those of the individual author.
The CIS marketing group, which is regulated for Investment Business by the Financial Services Authority, includes:
Co-operative Insurance Society Limited Registered in England number 3615R - for life assurance and pensions
CIS Unit Managers Limited Registered in England and Wales number 2369965 - for unit trusts and PEPs
CIS Policyholder Services Limited Registered in England and Wales number 3390839 - for ISAs and investment products bearing the CIS
name
Registered offices: Miller Street, Manchester M60 0AL Telephone 0161-832-8686 Internet http://www.cis.co.uk E-mail
cis@c...
CIS Deposit and Instant Access Savings Accounts are held with The Co-operative Bank p.l.c., registered in England and Wales number
990937, P.O. Box 101, 1 Balloon Street, Manchester M60 4EP, and administered by CIS Policyholder Services Limited as agent of the
Bank.
CIS is a member of the General Insurance Standards Council
CIS & the CIS logo (R) Co-operative Insurance Society Limited
********************************************************************************
Message #3 by "John Ruff" <papparuff@c...> on Mon, 27 May 2002 09:25:39 -0700
|
|
Andrew,
You can place a command button on the form that, when pressed, will sort
the data in Ascending or Descending order. I used the Customer table in
the Northwind database as a sample and created a button on a new form
called cmdSort. Here is code that will work.
Private Sub cmdSort_Click()
On Error GoTo Err_cmdSort_Click
' Place the letter D in the cmdSort
' Tag property when first creating this
' procedure. Also set the ControlTipText
' and Caption for the cmdSort to
' Sort in Ascending Order
Dim strSQL As String
' Select all records from the Customers table
strSQL = "SELECT Customers.* FROM Customers "
If cmdSort.Tag = "" Or cmdSort.Tag = "A" Then
' Concatenate the strSQL string with a string
' that sets the form's Sort Order in
' Ascending CompanyName order
strSQL = strSQL & "ORDER BY CompanyName"
' if the cmdSort.Tag property is "A" then
' Place the letter D in it's Tag property
cmdSort.Tag = "D"
' Change the cmdSort.Caption property
cmdSort.Caption = "Sort in Ascending Order"
' Change the cmdSort.ControlTipText property
cmdSort.ControlTipText = "Sort in Ascending Order"
Else
' Concatenate the strSQL string with a string
' that sets the form's Sort Order in
' Descending CompanyName order
strSQL = strSQL & "ORDER BY CompanyName DESC"
' if the cmdSort.Tag property is "A" then
' Place the letter A in it's Tag property
cmdSort.Tag = "A"
' Change the cmdSort.Caption property
cmdSort.Caption = "Sort in Descending Order"
' Change the cmdSort.ControlTipText property
cmdSort.ControlTipText = "Sort in Descending Order"
End If
' Set the form's recordsource property to the strSQL string
Me.RecordSource = strSQL
Exit_cmdSort_Click:
Exit Sub
Err_cmdSort_Click:
MsgBox Err.Description
Resume Exit_cmdSort_Click
End Sub
John Ruff - The Eternal Optimist :-)
Always Looking for a Contract Opportunity
xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498
-----Original Message-----
From: Andrew Payne [mailto:andrewpayne.plastics@b...]
Sent: Monday, May 27, 2002 3:46 PM
To: Access
Subject: [access] Data order
I have a form that displays data from a table, the data is always
displayed in ascending order, does anyone know how i could display the
data in descending order.
Thanks
Andrew
Message #4 by "Amy Wyatt" <amyw@c...> on Tue, 28 May 2002 21:46:52
|
|
In the forms properties there is a field called Order By. All you have to
do is enter the date fields name and then a space and then DESC to have
the form always in decending date order.
Example: table1.EntryDate DESC
Amy
> I have a form that displays data from a table, the data is always
d> isplayed in ascending order, does anyone know how i could display the
d> ata in descending order.
> Thanks
> Andrew
|
|
 |