Asending Order

G

Greg

Hello,
I am opening a form with a docmd.openform .... I would
like to insert code after the docmd that when the form is
opened it is ordered by the last name field in asending
order. How is this done?
Thanks in advance for your help.
 
A

Allen Browne

If you always want the target form to be sorted by last name, then simply
change its RecordSource to a query. In query design, use the Sorting row
under LastName field.

If the target form should only be sorted by LastName after it is opened this
way, you can use its OrderBy property like this:

DoCmd.OpenForm "Form1"
With Forms("Form1")
.OrderBy = "[LastName]"
.OrderByOn = True
End With
 

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