Quicky

  • Thread starter Thread starter Headache
  • Start date Start date
H

Headache

Does anyone know what is the VBA code to mimic the sort
ascending, sort descending buttons on the Form View
toolbar?
 
OK,

Ideally what you would need to do is to set the Focus to
the field you would like to sort.

i.e

Then use the following code behind a Command Button for
instance and this will toggle the Ascending and Descending:

Static bTitleAscending As Boolean

Me!Title.SetFocus

If Not bTitleAscending Then
DoCmd.RunCommand acCmdSortAscending
bTitleAscending = True
Else
DoCmd.RunCommand acCmdSortDescending
bTitleAscending = False
End If

Hope this helps you
Mark
 
Cheers Mark, I'll give that a try!

-----Original Message-----
OK,

Ideally what you would need to do is to set the Focus to
the field you would like to sort.

i.e

Then use the following code behind a Command Button for
instance and this will toggle the Ascending and Descending:

Static bTitleAscending As Boolean

Me!Title.SetFocus

If Not bTitleAscending Then
DoCmd.RunCommand acCmdSortAscending
bTitleAscending = True
Else
DoCmd.RunCommand acCmdSortDescending
bTitleAscending = False
End If

Hope this helps you
Mark

.
 
Back
Top