Sort records in form programmatically

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello,

using Access97 and WinNT

I am trying to have the records displayed on a continuous form sorted
programmatically by using the click event of the column label.
The forms displays a bunch of records, one of the fields is Date
Submitted .... when the user clicks on the label in the form header,
the records would then be sorted by Date. Clicking on the other labels
would sort the records accordingly.
The above works, however I would like to be able to switch between
Ascending and Descending .. to do that I have the following code

Me.OrderByOn = False
Me.OrderBy = ""

If Me.OrderBy = "[RI_Date] ASC" Then
Me.OrderBy = "[RI_Date] DESC"
Else
Me.OrderBy = "[RI_Date] ASC"
End If

Me.OrderByOn = True
Me.Filter = "source = 1"
Me.FilterOn = True

...... but that above does not work :( .... it only keeps on displaying
[RI_Date] in the Order By property of the form .... and obviously the
sort order does not change.

Could someone show me how to achieve this?

thanks,

regards,

Bertrand

.



Relevant Pages

  • Re: How do I get my mailing labels to move up/over a space when I
    ... Providing that there is a sort order. ... > Graham Mayor - Word MVP ... >> and paste the information on the last label to the blank empty label ...
    (microsoft.public.word.pagelayout)
  • RE: directory traversal
    ... C:\>cd winnt ... The filename, directory name, or volume label syntax is incorrect. ... current location in the tree. ... Internet communications are not secure and Softlab does not accept ...
    (Vuln-Dev)
  • getpivotdata function and dates
    ... getpivotdata function when one of the labels is a date. ... I have a pivot table with 'rep' as the row label ... and 'date' as the column label. ... I get the #REF error. ...
    (microsoft.public.excel.worksheet.functions)
  • Re: wxGrid
    ... > I have a grid. ... I want to sort it when a column label is clicked. ...
    (comp.lang.python)
  • wxGrid
    ... I have a grid. ... I want to sort it when a column label is clicked. ...
    (comp.lang.python)