Problem with Sorting on Report (1 Viewer)

TheSearcher

Registered User.
Local time
Today, 00:08
Joined
Jul 21, 2011
Messages
304
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
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 21:08
Joined
Aug 30, 2003
Messages
36,139
To be reliable the sorting has to be set up in Group & Sort from the report's design view.
 

TheSearcher

Registered User.
Local time
Today, 00:08
Joined
Jul 21, 2011
Messages
304
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?
 

TheSearcher

Registered User.
Local time
Today, 00:08
Joined
Jul 21, 2011
Messages
304
Figured it out. The sort has to come before the group. Thanks for your help!
1700580453696.png
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 21:08
Joined
Aug 30, 2003
Messages
36,139
Glad you got it...sorted. ;)
 

Users who are viewing this thread

Top Bottom