Sort by two columns in VBA

  • Thread starter Thread starter marko
  • Start date Start date
M

marko

I have made a form with a recordsource and I have sort buttons which
through VBA sort by columns. Now i would like to sort by two columns.
First sort everything by Name and then by Quantity! Is this possible
and how?
I'm using the commands sort ascending and sort descending in VBA.
Thanks,

Marko
 
I have made a form with a recordsource and I have sort buttons which
through VBA sort by columns. Now i would like to sort by two columns.
First sort everything by Name and then by Quantity! Is this possible
and how?
I'm using the commands sort ascending and sort descending in VBA.
Thanks,

Marko

Access sorts records in a left to right order.
Using VBA you would write, in an event on the form:

Me.OrderBy = "[LastName],[Quantity]"
Me.OrderByOn = True


Do you really have a field named "Name"?
Name is a reserved Access/VBA/Jet word and should not be used as a
field name.
For additional reserved words, see the Microsoft KnowledgeBase article
for your version of Access:

109312 'Reserved Words in Microsoft Access' for Access 97
209187 'ACC2000: Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
321266 'ACC2002: Microsoft Jet 4.0 Reserved Words'
 
No i don't have a field name, i just said that for an example but it
was is supose a bad one.
Thanks for your answer!

Marko
 
Yes, i know that i can make a query but i have a lot of command buttons
on that form and i would also like to have that type of advanced
sorting.
 
Back
Top