Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / December 2007

Tip: Looking for answers? Try searching our database.

Sort ascending and descending

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pietro - 26 Dec 2007 20:26 GMT
Hi,

  I want to sort a fom ascendingly according to the RECEIVED field,what's
the code that i should use in the click event of a button?
 I do want to do the same to sort it decendingly..
KARL DEWEY - 26 Dec 2007 20:51 GMT
Click in the field and then the 'A-Z' icon on the icon bar.  Use the 'Z-A' to
sort descending.
Signature

KARL DEWEY
Build a little - Test a little

> Hi,
>
>    I want to sort a fom ascendingly according to the RECEIVED field,what's
> the code that i should use in the click event of a button?
>   I do want to do the same to sort it decendingly..
Pietro - 26 Dec 2007 20:54 GMT
Thank you for your reply...
I know this well,i need to crate a button to do this as usually i hide the
main menu bar from my database...

> Click in the field and then the 'A-Z' icon on the icon bar.  Use the 'Z-A' to
> sort descending.
[quoted text clipped - 4 lines]
> > the code that i should use in the click event of a button?
> >   I do want to do the same to sort it decendingly..
KARL DEWEY - 26 Dec 2007 21:28 GMT
Ok, one way is to create two queries, one sorting ascending and the other
descending.  
Add a new field to each like this ---
    Sort_Field: [Forms]![YourFormName]![CheckBox]
In the query for one use a -1 (minus one) as criteria and the other use a 0
(zero).
Put both queries in a union query.   Use the union query as source for the
form.  In the CheckBox event After Update have it requery.  Label it 'Sort
Ascending' so when checked it will be a -1.

Only one of the first two queries will pull records to output from the union.
Signature

KARL DEWEY
Build a little - Test a little

> Thank you for your reply...
> I know this well,i need to crate a button to do this as usually i hide the
[quoted text clipped - 8 lines]
> > > the code that i should use in the click event of a button?
> > >   I do want to do the same to sort it decendingly..
fredg - 27 Dec 2007 04:09 GMT
> Hi,
>
>    I want to sort a fom ascendingly according to the RECEIVED field,what's
> the code that i should use in the click event of a button?
>   I do want to do the same to sort it decendingly..

Code the command button's Click event:
If Me.OrderBy = "Receiving" Then
   Me.OrderBy = "Receiving Desc"
   Me.OrderByOn = True
Else
   Me.OrderBy = "Receiving"
   Me.OrderByOn = True
End If  
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.