Button to sort a dataview subform

  • Thread starter Thread starter Mike I.
  • Start date Start date
M

Mike I.

I could use some help. I have 1 mainform, and 1 subform which is tied
to a field on the main form. I would like to add a button to the main
form that when clicked will sort the dataview of the subform by a
predefined field. When users are using this form they will be
modifying the contents of the "sorted" field, but I don't want the
subform to sort until the button is clicked. I have put the following
code in the click event of the "sort" button but once you click the
button the any changes you make to the sorted field on the subform
triggers an orderby event.

Me.frmPriorityOrderSub.Form.OrderBy = "PriorityOrder"
Me.frmPriorityOrderSub.Form.OrderByOn = True

Can someone please tell me how I can implement sort button that won't
sort the dataview each time a change an item in it?

Thanks for all help in advance
 
One way would be to have a hidden field on the subform that you sort by.
Then as you change the visible data nothing will change, and when the user
clicks the sort button it would have to update the values in the hidden sort
field to make the subform records sort the way you want.

Doug
 
Back
Top