Sorting Choices

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

Guest

I have a form with a listbox that will display a list of items that include
description and color when an invoice number is selected from a combo box. I
think I can fix it so that the user has choice of viewing the listbox that
will sort by description first and then color, or by color first and then
description.

On the form is a button that opens up a report with the same list printed.
However, how can I configure the report to sort the item list by description
first or by color first according to what had been chosen in the form? Is
there a better way that creating 2 reports: one sorted by description first
and one by color first? Thanks.
ck
 
You can specify a sort order in the Report_Open event:

Select Case SomeVariable
Case 1
Me.OrderBy = "Description, Color"
Case 2
Me.OrderBy = "Color, Description"
Case Else
MsgBox "Unexpected value for SomeVariable."
End Select
Me.OrderByOn = True

HTH,
 
Thanks George. I had a little trouble with the "SomeVariable" in your example
but Duane's suggestion to look at Allen Browne's website gave me some idea on
what can I use for the "SomeVariable" and got it working. Thanks again for
your help.
ck
 
NP :-)

The OP didn't mention grouping, so I assumed it was purely a sort question
(i.e., sorting fields within a Detail section that were not included in any
grouping).
 
Back
Top