RE: Sorting filtered list on form with a Command Button

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Maurice,

When I described my problem I tried to simplify it. Above each column in my
form I have sort buttons which toggle between ascending and descending so my
user can click a button above any column and resort it quickly. So putting
it in the query isn't an option.

Thanks!

"Maurice" wrote:

wouldn't it be easier to set the sort option in the query as well?
--
Maurice Ausum


"LDMueller" wrote:

I have a form CLIENTLIST. When I open this form it runs the query
qryClientLst. One of the fields in the query named ClientID has the criteria
"Like [Enter Client Number]". When I open the form CLIENTLIST I'm prompted
to "Enter Client Number". When I do the form opens and only the files with
the client number I entered appear. So basically it's a filtered form. All
of this works fine.

I created a command button above the column ClientId on my form so my users
can click on the button and sort Ascending or Descending. Below is my code
for this. My only problem is when I click on the command button, I get the
prompted to [Enter Client Number] again.

If I remove the prompted from the query qryClientLst so it displays all
records when I open the form, everything works fine. But I need it to sort
the filtered list.

Private Sub cmdSort_Click()
If Right(Me.OrderBy, 4) = "Desc" Then
Me.OrderBy = "[ClientID]"
Else
Me.OrderBy = "[ClientID]" & " Desc"
End If
Me.OrderByOn = True
End Sub

Can anyone help me?

Thanks,

LDMueller
.



Relevant Pages

  • Re: Module Cruelly Kissed to Death by -O2
    ... It makes a huge difference in a merge sort and brings g95's ... descending 0. ... ascending 0. ...
    (comp.lang.fortran)
  • Re: Can this be done?
    ... I ALWAYS sort by name ascending and date descending - its a golden rule ... > In this code page paste in the following sub: ...
    (microsoft.public.excel.misc)
  • Re: Sort Formula
    ... This sorts in ascending order, ... To sort in descending order, text before numbers, replace the SMALL ... No intermediate ancillary calculations in other cells needed. ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Complex sort of matrix possible, e.g. like Excel?
    ...  I'd like to sort the matrix on ... column A ascending and, within that, column B descending. ...
    (comp.lang.ruby)
  • Re: Applying Reports Sort Order via code
    ... Ascending is False, Descending is True according to the help file. ... Now the users want to be able to sort the ...
    (microsoft.public.access.reports)