sort

J

jmonty

I am re-posting this - looking for a different approach.
(cannot use the report sorting & grouping dialog):

I have a form with 3 comboboxes used for field selections
for the user to select the sort order of a report.
I understand how to create a parameter query, but the form
I have designed allows for
3 sort (field) selections, each either ASC or DESC, which
potentially creates ~16 possible sorts. I have to be able
to assign the sort to the query/report based on the
form/combobox selections.
On a side note:
To complicate things, I have 4 other fields on this form
that I use for parameters in the query and with the
different combinations of those also...this could get
pretty ugly.

Bottom line:
(NOT using the report grouping & sorting dialog):
What I need is a way to assign the sort of the report
(where my query is the recordsource) on-the-fly, based on
user selections (3 combo boxes w/ radio buttons for
ASC/DESC) on the form. (Looks somewhat similar to the sort
dialog in Excel)

Need some serious expert help. Thanx again in advance for
your help.

jmonty
Joel Montalvo
 
D

Douglas J. Steele

I'm sorry: there's no other option with reports.

You can dynamically control the sorting and grouping values.

Here's an example from the Help file:

The following example creates a group level on an OrderDate field on a
report called OrderReport. The report on which the group level is to be
created must be open in Design view. Since the header and footer arguments
are set to True (-1), the function creates both the header and footer for
the group level. The header and footer are then sized.

Sub CreateGL()
Dim varGroupLevel As Variant

' Create new group level on OrderDate field.
varGroupLevel = CreateGroupLevel("OrderReport", "OrderDate", _
True, True)
' Set height of header/footer sections.
Reports!OrderReport.Section(acGroupLevel1Header).Height = 400
Reports!OrderReport.Section(acGroupLevel1Footer).Height = 400
End Sub
 
J

jmonty

I found the answer to my problem from a link to the
MS knowledge base (example). I thought I'd share it with
you:

http://support.microsoft.com/?kbid=146310

I had to open the report in design mode, then assign the
OrderBy property and set the OrderByOn = true, then
preview the report.

Thanx for your help, but I found it on my own.
jmonty
Joel Montalvo
 

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