The sorting depends on the selection made by a user in the option group:
Forms!frmChooseSort!grpSort
You would need to have some method for your users to make a selection. In
the example, this was done through a form named "frmChooseSort" and an option
group named "grpSort". You would need to use your own form and control.
Your code would need to be modified based on your fields and controls.