Dynamic Data Sort in a Report

scotthutchings

Registered User.
Local time
Today, 07:16
Joined
Mar 26, 2010
Messages
96
I have an option where the user can select which field to use to sort the data in a report (in this case, they can choose to sort by Date, BidNumber or ProjectName). I have created 3 different reports in order to accomplish this, with the only difference being the primary sort group. Can I send this information to a single report as part of my code call instead of having to create 3 separate reports? If so, how do I do it?

Here is my code (me.optSort holds the sort value selected)
Code:
Select Case (Me.optSort)
        Case 1  'by date
            stDocName = "Bid - Bid List by Date CONDENSED"
        Case 2  'by number
            stDocName = "Bid - Bid List by BidNumber CONDENSED"
        Case 3  'by Project
            stDocName = "Bid - Bid List by ProjectName CONDENSED"
    End Select
 
DoCmd.OpenReport stDocName, acViewPreview, , Include & DateFilter & StatusFilter

Thanks for your help.
 
Search the Help in your code editor for 'GroupLevel'. That should lead you to the property 'SortOrder'.

HTH,
-dK
 
Thanks! I realized that the code must be placed in the report's OnOpen event. Thanks again for your help.
 

Users who are viewing this thread

Back
Top Bottom