Problem with Sorting on Report

TheSearcher

Registered User.
Local time
Today, 11:28
Joined
Jul 21, 2011
Messages
342
I have a report which has a query as its recordsource. The query sorts the "Task_No" field in ascending order. The query works fine but when the report opens the "Task_No" field is not always sorted properly. Sometimes it is and sometimes it isn't. This just started happening after we migrated to Azure O365 (not sure if this is relevant). Below is the code used to open the report. Has anyone run into this before?

Code:
Private Sub cmd_ViewNote_Click()

Globals.glb_TransID = Me.txt_TransID

If Application.CurrentProject.AllReports("N_Note").IsLoaded Then
  DoCmd.Close acReport, "N_Note"
End If
 
DoCmd.OpenReport "N_Note", acViewPreview, , "Trans_ID = " & Globals.glb_TransID, acWindowNormal

Globals.glb_TransID = 0

End Sub
 
To be reliable the sorting has to be set up in Group & Sort from the report's design view.
 
Thanks for your reply pbaldy.
The sorting is set up in the Group & Sort from the report's design view. It is also sorted in the query recordsource. So, I have both bases covered.
I should mention that the sort issue is contained in a subreport. When I click on the subreport within the main report the Group & Sort options only show fields that are in the main report (no option to sort the fields in the subreport). However, the proper Group & Sort options show when viewing the subreport by itself. Any ideas?
 
Figured it out. The sort has to come before the group. Thanks for your help!
1700580453696.png
 

Users who are viewing this thread

Back
Top Bottom