Quicky

H

Headache

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

Mark Sippitt

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
 
H

Headache!

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

.
 

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