sort buttons

  • Thread starter Thread starter Phil
  • Start date Start date
P

Phil

Hi,

I have a continuous form with 3 fields on it. I would
like to add three command buttons which would cause the
data to sort based of which button was clicked. If the
first button was clicked the data would sort on the first
field, if the second was clicked the data would sort on
the second field, and so on.

I believe there is a way to do this, but I can't figure it
out. I don't want to click on the field and then on the a-
z or z-a buttons.

Thanks,
Phil
 
Are you attempting to sort records in a form or report. This is the reports
NG yet you state "a-z" buttons which aren't part of reports.
 
Hi,

It's a form. When in the form, if I click on a field the
sort (a-z and z-a) icons become active. When you click on
either, the form fields are sorted based on the icon
clicked. It is definitely a form.

Thanks,
Phil
 
I usually write code that will change the SQL of the Record Source property
of the form.
Dim strSQL as String
strSQL = "SELECT .... ORDER BY MyField;"
Me.RecordSource = strSQL

Rather than write the same code over and over in different command buttons,
I write one function that accepts the sorting field as an argument.
 
Back
Top