Sorting records in a subform

G

Gary

I have a form with a subform (subform based on a query).
I am looking for code that can sort the records in the
subform by clicking on a command button.

Thanks,

Gary.
 
M

Marshall Barton

Gary said:
I have a form with a subform (subform based on a query).
I am looking for code that can sort the records in the
subform by clicking on a command button.


If the buttom in on the main form:

Me.subformcontrol.Form.OrderBy = "nameoffield"
Me.subformcontrol.Form.OrderByOn = True

If the button is in the subform:

Me.OrderBy = "nameoffield"
Me.OrderByOn = True
 

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

Top