Sort continous form by 2 colums

  • Thread starter Thread starter Jane
  • Start date Start date
J

Jane

Hello everyone

Is it possible to sort a continous form by more than one field

I have this

Private Sub SortAZ_Name_Click()
Me.OrderBy = "Surname"
End Sub

But I would like something like this

Private Sub SortAZ_Name_Click()
Me.OrderBy = "Surname" and 1stname
End Sub

Is this possible

Thank you for your help if you can offer any tips

Jane
 
From the Help file ...........
The OrderBy property is a string expression that is the name of the field or
fields on which you want to sort records. When you use more than one field
name, separate the names with a comma (,).
When you set the OrderBy property by entering one or more field names, the
records are sorted in ascending order. Similarly, Visual Basic sorts these
fields in ascending order by default.
If you want to sort records in descending order, type DESC at the end of the
string expression. For example, to sort customer records in descending order
by contact name, set the OrderBy property to "ContactName DESC".

So you need ...
Me.OrderBy = "Surname", "1stname"

This will sort both fields Ascending.

Steve
(e-mail address removed)
 
Hello everyone

Is it possible to sort a continous form by more than one field

I have this

Private Sub SortAZ_Name_Click()
Me.OrderBy = "Surname"
End Sub

But I would like something like this

Private Sub SortAZ_Name_Click()
Me.OrderBy = "Surname" and 1stname
End Sub

Is this possible

Thank you for your help if you can offer any tips

Jane

Sure. The OrderBy property can consist of one to ten (or maybe more)
fieldnames, separated by commas:

Me.OrderBy = "[Surname],[1stName],[MiddleInitial],[Suffix]"
 
Jane said:
Hello everyone

Is it possible to sort a continous form by more than one field

I have this

Private Sub SortAZ_Name_Click()
Me.OrderBy = "Surname"
End Sub

But I would like something like this

Private Sub SortAZ_Name_Click()
Me.OrderBy = "Surname" and 1stname
End Sub

Is this possible

Thank you for your help if you can offer any tips

Jane
 
Back
Top