Form sort order

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to open Form B (which shows the results of analysis of several tables
using a query) by using various controls on Form A to give me a variety of
sort orders. In some cases this could be 2 sort orders or in others just
one. They will all be probally in ascending order. I did use the following
but this would only work for 1 sort . I need to do 2 in some cases
DoCmd.GoToControl "Text0"
DoCmd.RunCommand acCmdSortAscending
Can someone help me please
 
You'll need to set the OrderBy property of the form B to do what you want.

This can be done similarly to what you're now doing, except you don't need
to set focus to a text box and then sort based on that. Just replace those
two lines of code with these two lines of code (in this example, the form
will sort descending on Field1 and ascending on Field2, in that order of
precendence):

Forms!FormB.OrderBy = "Field1 DESC, Field2"
Forms!FormB.OrderByOn = True
 
Many thanks .I had thought this only worked within the Form itself but I have
a lot to learn
 
Back
Top