Command button to Sort

  • Thread starter Thread starter Keith Ward
  • Start date Start date
K

Keith Ward

Hi,

I have a form with a subform which contains fields I don't want to see but
want to sort by.

I would like to put a command button in the top form which when clicked
sorts the subform by the invisible field by a-z.

How do I achieve this in code?

Thanks

Keith
 
Use this kind of thing in the Event procedure for your command button:

Private Sub cmdSort_Click()
If Me.Dirty Then Me.Dirty = False
Me.OrderBy = "[NameOfYourFieldHere]"
Me.OrderByOn = True
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top