This thread sounds very much like what I'm wanting to do, but I couldn't get my adapted version of the supplied code to do anything. I have a tabular form with column headings in the form header, and form information in the detail. I want to have a button next to a label in the form header to allow the user to sort by that field (exactly the same as you have in Windows Explorer for sorting views by filename etc). I can achieve exactly what I want by enabling and unlocking the field in question, clicking on it and then clicking the A-Z button, but I need the fields disabled and locked, and want a 'pretty' way of sorting (by default the form is sorted by another field, but I want to provide the option to sort by the field called User_MachineName).
My code currently is:
Private Sub Sort_Click()
Me.OrderBy = Me.User_MachineName
End Sub
but this didn't seem to do anything. What am I doing wrong, and how do I go about correcting it? Thanks!