From: Jane on 3 Apr 2010 15:45 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: Steve on 3 Apr 2010 16:10 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 santus(a)penn.com "Jane" <Jane(a)discussions.microsoft.com> wrote in message news:C4DC35E5-80B8-4729-AF24-41B09EABEBB3(a)microsoft.com... > 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: Douglas J. Steele on 3 Apr 2010 16:11 Private Sub SortAZ_Name_Click() Me.OrderBy = "Surname,1stname" End Sub -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Jane" <Jane(a)discussions.microsoft.com> wrote in message news:C4DC35E5-80B8-4729-AF24-41B09EABEBB3(a)microsoft.com... > 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: John W. Vinson on 3 Apr 2010 16:11 On Sat, 3 Apr 2010 12:45:01 -0700, Jane <Jane(a)discussions.microsoft.com> wrote: >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]" -- John W. Vinson [MVP]
From: Jane on 4 Apr 2010 02:42
Dear Steve, Douglas and John Thank you for your help. It works really well now. Jane "Jane" wrote: > 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 |