sorting calculated field access report (1 Viewer)

vagues0ul

Registered User.
Local time
Today, 15:16
Joined
Sep 13, 2018
Messages
103
i have a calculated field in access report and when i sort report on that field it gives me this error.

Operation is not supported for this type of object

the field is from a table where it is calculating average of 3 other fields.
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:16
Joined
Sep 21, 2011
Messages
14,048
Calculate in the source and then sort on it?
 

June7

AWF VIP
Local time
Today, 14:16
Joined
Mar 9, 2014
Messages
5,423
Is the calculation in textbox on report? Calculate in the report RecordSource query. Use that field for sorting.

Otherwise, use the expression as sort parameter in the report design, not the textbox.
 
Last edited:

vagues0ul

Registered User.
Local time
Today, 15:16
Joined
Sep 13, 2018
Messages
103
Is the calculation in textbox on report? Calculate in the report RecordSource query. Use that field for sorting.

Otherwise, use the expression as sort parameter in the report design, not the textbox.

am i doing it right ?

Code:
Private Sub Report_Load()
Report.OrderBy = "[termttl]*0.4 + [stmttl]*0.6 Desc"


End Sub
 

June7

AWF VIP
Local time
Today, 14:16
Joined
Mar 9, 2014
Messages
5,423
I have never used VBA to set a report OrderBy property. Either set the property in design or use report Sorting & Grouping.

If you have any Sorting & Grouping setup, the OrderBy property will be ignored. Sorting & Grouping takes precedence.

I presume report is named something other than "Report". Correct syntax:

Me.OrderBy = "[termttl]*0.4 + [stmttl]*0.6 Desc"
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:16
Joined
Feb 19, 2002
Messages
42,976
Don't do this with code, modify the report itself. Open the report in design view and add a sort option using the sorting & grouping dialog. Reference the calculated field in the RecordSource.
 

vagues0ul

Registered User.
Local time
Today, 15:16
Joined
Sep 13, 2018
Messages
103
Don't do this with code, modify the report itself. Open the report in design view and add a sort option using the sorting & grouping dialog. Reference the calculated field in the RecordSource.

the error i posted is the result of same steps you are mentioning
 

June7

AWF VIP
Local time
Today, 14:16
Joined
Mar 9, 2014
Messages
5,423
We are going in circles. Suggestions are proven methods. If you want to provide db for analysis, follow instructions at bottom of my post.
 

Users who are viewing this thread

Top Bottom