How to sort a report based on an unbound calculated control?

P

PAULinLAOS

I'm not sure that my terminology is right in my question above but here's
what I want to do:

I've got a report that looks like this:

Country Total Tourists BedsNights
Albania 10 35
etc...

BedNights is a calculated control. It is not in the query, but is something
that I calculate on my table. How do I sort the output on my report by
BedNights? I understand how to sort a report but I am having trouble using an
expression to do it. I put in the Field/Expression field under the sort
criteria for the report "=[BedsNights]" but that didn't work. I tried
"=[rptBedsnights]![BedsNights]" but that didn't work.

Without changing my query, is it possible to sort a report based on a
calculated control made in the report itself?
 
D

Duane Hookom

You told us almost everything except how BedsNights is calculated. If the
calculation involves a summary value from a header or footer, this may not
be possible.
 
P

PAULinLAOS

Yes, here is more information about my report. I The report is based on a
query which has records with details about overnight stays in guesthouses by
tourists of different nationalities. It shows how many people of a given
nationality stayed (totaltourists) and calculates how many nights they stayed
for (totalnights).

OK then, my report lists each country and summarizes the total tourists and
total nights they stayed based on my query. It lists each country only once
(I don't show the details). On the report, I make another column that
calculates BedNights by multiplying totaltourists by totalnights. I don't
think that this value is in the header or footer. So, BedNights is not coming
from my query, but is a value calculated on my report. It is based on summary
values for totaltourists and totalnights, which are generated by the report.

Perhaps, there is a way to summarize this stuff in the query first so that
my report will work for sure?





Duane Hookom said:
You told us almost everything except how BedsNights is calculated. If the
calculation involves a summary value from a header or footer, this may not
be possible.

--
Duane Hookom
MS Access MVP
--

PAULinLAOS said:
I'm not sure that my terminology is right in my question above but here's
what I want to do:

I've got a report that looks like this:

Country Total Tourists BedsNights
Albania 10 35
etc...

BedNights is a calculated control. It is not in the query, but is
something
that I calculate on my table. How do I sort the output on my report by
BedNights? I understand how to sort a report but I am having trouble using
an
expression to do it. I put in the Field/Expression field under the sort
criteria for the report "=[BedsNights]" but that didn't work. I tried
"=[rptBedsnights]![BedsNights]" but that didn't work.

Without changing my query, is it possible to sort a report based on a
calculated control made in the report itself?
 
D

Duane Hookom

You should be able to summarize this information and add it to the record
source of your report. This will allow you to sort by the values.

--
Duane Hookom
MS Access MVP
--

PAULinLAOS said:
Yes, here is more information about my report. I The report is based on a
query which has records with details about overnight stays in guesthouses
by
tourists of different nationalities. It shows how many people of a given
nationality stayed (totaltourists) and calculates how many nights they
stayed
for (totalnights).

OK then, my report lists each country and summarizes the total tourists
and
total nights they stayed based on my query. It lists each country only
once
(I don't show the details). On the report, I make another column that
calculates BedNights by multiplying totaltourists by totalnights. I don't
think that this value is in the header or footer. So, BedNights is not
coming
from my query, but is a value calculated on my report. It is based on
summary
values for totaltourists and totalnights, which are generated by the
report.

Perhaps, there is a way to summarize this stuff in the query first so that
my report will work for sure?





Duane Hookom said:
You told us almost everything except how BedsNights is calculated. If the
calculation involves a summary value from a header or footer, this may
not
be possible.

--
Duane Hookom
MS Access MVP
--

PAULinLAOS said:
I'm not sure that my terminology is right in my question above but
here's
what I want to do:

I've got a report that looks like this:

Country Total Tourists BedsNights
Albania 10 35
etc...

BedNights is a calculated control. It is not in the query, but is
something
that I calculate on my table. How do I sort the output on my report by
BedNights? I understand how to sort a report but I am having trouble
using
an
expression to do it. I put in the Field/Expression field under the sort
criteria for the report "=[BedsNights]" but that didn't work. I tried
"=[rptBedsnights]![BedsNights]" but that didn't work.

Without changing my query, is it possible to sort a report based on a
calculated control made in the report itself?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top