Sort Using Code in a report

G

Guest

I am using one report to display info in various ways dependent upon which
field I select from an option box that calls a report using the case command.
I want to sort records in that field based upon my selected field. I can
only apply one sort order in the Sorting and Grouping properties, so I need a
line of code that runs as the report is opened, So far, I am using the
following:
If Forms![PrintReportsDialog]![Select Order Type] = 1 And
Forms![PrintReportsDialog].[Select Number Both] = 1 Then
DoCmd.OpenReport "rptOrder", ReportDest, ,
Eval("IIf(Forms![PrintReportsDialog]![Select List] Is Null,"""",""[OrderID] =
Forms![PrintReportsDialog]![Select List]"")")
Reports![rptOrder]![JNumber].Visible = False
Reports![rptOrder]![Number].Visible = True
End If

When the Number field is visible, I want to sort on that field in ascending
order...and likewise when the JNumber field is visible. Any suggestions

Thanks
 

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