Sort on calculated field?

  • Thread starter Thread starter Guest
  • Start date Start date
Yes:

SELECT [Field1] + [Field2] AS MySum
FROM TableName
ORDER BY [Field1] + [Field2];
 
Since this is a Reports newsgroup, the answer is also yes but set the
Field/Expression in your sorting and grouping dialog to something like:
=[Field1] + [Field2]

--
Duane Hookom
MS Access MVP
--

Ken Snell said:
Yes:

SELECT [Field1] + [Field2] AS MySum
FROM TableName
ORDER BY [Field1] + [Field2];

--

Ken Snell
<MS ACCESS MVP>

Bdavis said:
Is this possible?
 
Where is the calculation being done? If it is in the query that is the
report's source then use the Sorting and Grouping dialog to refer to the
column (field) from the query.

If the calculation is done in the report itself, you MAY be able to use the
same calculation in the Sorting and Grouping dialog by putting the
calculation in the first column of the dialog. Precede the calculation
expression with an equals sign. For example,
=[MyValueA] + [MyValueB]

In Design view of your report:
Select View: Sorting and Grouping from the menu
Click Field Expression (column 1) and choose what you want to sort by
Click Ascending or Descending in Column two
Close Sorting and Grouping window
Save the report

As far as I know the calculation can't use any of the aggregate functions
 
I need glasses... going through too many newsgroups at once, I'm afraid!
Thanks, Duane.

--

Ken Snell
<MS ACCESS MVP>

Duane Hookom said:
Since this is a Reports newsgroup, the answer is also yes but set the
Field/Expression in your sorting and grouping dialog to something like:
=[Field1] + [Field2]

--
Duane Hookom
MS Access MVP
--

Ken Snell said:
Yes:

SELECT [Field1] + [Field2] AS MySum
FROM TableName
ORDER BY [Field1] + [Field2];

--

Ken Snell
<MS ACCESS MVP>

Bdavis said:
Is this possible?
 
I am concerned the "Sort on calculated field" is the result of an aggregate
function such as Sum() or Count() in a group footer.

Bdavis didn't provide enough information to provide more than a WAG.

--
Duane Hookom
MS Access MVP
--

Ken Snell said:
I need glasses... going through too many newsgroups at once, I'm afraid!
Thanks, Duane.

--

Ken Snell
<MS ACCESS MVP>

Duane Hookom said:
Since this is a Reports newsgroup, the answer is also yes but set the
Field/Expression in your sorting and grouping dialog to something like:
=[Field1] + [Field2]

--
Duane Hookom
MS Access MVP
--

Ken Snell said:
Yes:

SELECT [Field1] + [Field2] AS MySum
FROM TableName
ORDER BY [Field1] + [Field2];

--

Ken Snell
<MS ACCESS MVP>

Is this possible?
 
Back
Top