A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I sort on a calculated field in a report?



 
 
Thread Tools Display Modes
  #1  
Old July 12th, 2007, 05:56 PM posted to microsoft.public.access.reports
need help
external usenet poster
 
Posts: 34
Default How do I sort on a calculated field in a report?

I created a calculated, unbound field in a report that i have to sort on. Can
anyone help me figure out how to?

Thanks.

  #2  
Old July 12th, 2007, 07:00 PM posted to microsoft.public.access.reports
Ofer Cohen
external usenet poster
 
Posts: 1,683
Default How do I sort on a calculated field in a report?

Add the calculated field to the Report RecordSource

Select TableName.* , [Field1]+[Field2] As NewField From TableName

Then in the report Grouping and Sorting add the new field "NewField" and
sort by it.

To sort the report by any field it need to be in the Report RecordSource

--
Good Luck
BS"D


"Need Help" wrote:

I created a calculated, unbound field in a report that i have to sort on. Can
anyone help me figure out how to?

Thanks.

  #3  
Old July 12th, 2007, 07:24 PM posted to microsoft.public.access.reports
Need Help
external usenet poster
 
Posts: 52
Default How do I sort on a calculated field in a report?

I'm not sure what you mean by "Select TableName". The calculated field is not
in the table. I added this field in the report to calculate percentage on two
other fields that are in the table.

Thanks,

"Ofer Cohen" wrote:

Add the calculated field to the Report RecordSource

Select TableName.* , [Field1]+[Field2] As NewField From TableName

Then in the report Grouping and Sorting add the new field "NewField" and
sort by it.

To sort the report by any field it need to be in the Report RecordSource

--
Good Luck
BS"D


"Need Help" wrote:

I created a calculated, unbound field in a report that i have to sort on. Can
anyone help me figure out how to?

Thanks.

  #5  
Old July 12th, 2007, 07:40 PM posted to microsoft.public.access.reports
Ofer Cohen
external usenet poster
 
Posts: 1,683
Default How do I sort on a calculated field in a report?

I know that the calculaed field is not in the form, but the formula in the
calculated field probably consist the field from the table

Something like
=[Field1]+[Field2]

So, to the reprot RcordSource you can add another field

NewField: [Field1]+[Field2]

And then sort by the "NewField"

If you need help, please post the report RecordSource and the Control Source
of the calculated text box
--
Good Luck
BS"D


"Need Help" wrote:

I'm not sure what you mean by "Select TableName". The calculated field is not
in the table. I added this field in the report to calculate percentage on two
other fields that are in the table.

Thanks,

"Ofer Cohen" wrote:

Add the calculated field to the Report RecordSource

Select TableName.* , [Field1]+[Field2] As NewField From TableName

Then in the report Grouping and Sorting add the new field "NewField" and
sort by it.

To sort the report by any field it need to be in the Report RecordSource

--
Good Luck
BS"D


"Need Help" wrote:

I created a calculated, unbound field in a report that i have to sort on. Can
anyone help me figure out how to?

Thanks.

  #6  
Old July 12th, 2007, 08:18 PM posted to microsoft.public.access.reports
Need Help
external usenet poster
 
Posts: 52
Default How do I sort on a calculated field in a report?

'No controls on the report' you mean I can't include another calculated field
in this expression? - Field2/Field3, where Field 3 is another calculation not
included in the table. When I copied the calculation into the Grouping and
Sorting, it gave me an error message. I can't get it work.

I have two fields in the table and two calculated fields in the report.
Field1 and Field2 are entered in the table. [Field3] is a calculation on
[Field1*45]. [Field4] is a calculation on [Field2]/[Field3].

Thanks for your help.

"Marshall Barton" wrote:

Need Help Need wrote:

I created a calculated, unbound field in a report that i have to sort on. Can
anyone help me figure out how to?



Put the expression for the calculation in Sorting and
Grouping. Be sure to only refer to fields in the report's
record source table/query and no controls on the report.

--
Marsh
MVP [MS Access]

  #7  
Old July 12th, 2007, 08:24 PM posted to microsoft.public.access.reports
Need Help
external usenet poster
 
Posts: 52
Default How do I sort on a calculated field in a report?

'No controls on the report' you mean I can't include another calculated field
in this expression? My calculation is [Field2]/[Field3] where Field2 is in
the table and Field3 is a calculated field in the report. If I copy it into
the Grouping and Sorting, it gives me an error message: "Field3"

"Marshall Barton" wrote:

Need Help Need wrote:

I created a calculated, unbound field in a report that i have to sort on. Can
anyone help me figure out how to?



Put the expression for the calculation in Sorting and
Grouping. Be sure to only refer to fields in the report's
record source table/query and no controls on the report.

--
Marsh
MVP [MS Access]

  #8  
Old July 12th, 2007, 09:12 PM posted to microsoft.public.access.reports
Need Help
external usenet poster
 
Posts: 52
Default How do I sort on a calculated field in a report?

Marshall,
I eliminated the control on the report and copied the expression into
Grouping and Sorting. It worked.
Thanks for your help.

"Need Help" wrote:

'No controls on the report' you mean I can't include another calculated field
in this expression? My calculation is [Field2]/[Field3] where Field2 is in
the table and Field3 is a calculated field in the report. If I copy it into
the Grouping and Sorting, it gives me an error message: "Field3"

"Marshall Barton" wrote:

Need Help Need wrote:

I created a calculated, unbound field in a report that i have to sort on. Can
anyone help me figure out how to?



Put the expression for the calculation in Sorting and
Grouping. Be sure to only refer to fields in the report's
record source table/query and no controls on the report.

--
Marsh
MVP [MS Access]

  #9  
Old July 12th, 2007, 09:19 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default How do I sort on a calculated field in a report?

You got the error because your expression used control names
instead of field names. I guess the expression you need to
use could be:
=Field2 / (Field1 * 45)
which uses only **fields** from the table/query.

You can use the same calculation in the report's record
source query as Ofer suggested. It might be easier to
understand, but it makes no difference to the report.

Part of your confusion is because you are using the word
"field" in an ambiguous way. Fields are columns in a table
or query. Controls are the thingies you have in the
form/report that display the value of a field or expression.
A lot of people use field for either one, but not in a
discussion about both where you need to distinguish between
the two different objects.
--
Marsh
MVP [MS Access]


Need Help wrote:
'No controls on the report' you mean I can't include another calculated field
in this expression? - Field2/Field3, where Field 3 is another calculation not
included in the table. When I copied the calculation into the Grouping and
Sorting, it gave me an error message. I can't get it work.

I have two fields in the table and two calculated fields in the report.
Field1 and Field2 are entered in the table. [Field3] is a calculation on
[Field1*45]. [Field4] is a calculation on [Field2]/[Field3].

"Marshall Barton" wrote:

Need Help Need wrote:

I created a calculated, unbound field in a report that i have to sort on. Can
anyone help me figure out how to?



Put the expression for the calculation in Sorting and
Grouping. Be sure to only refer to fields in the report's
record source table/query and no controls on the report.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:59 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.