Value from other than underlying query?

S

Serendipity

I have a report that is working fantastically, except that I want a subtotal
in a group footer and a grand total in a page footer. These values come from
queries designed to get them. I couldn't include these queries in the query
that the report is based on because when I did I got duplicate rows. Is there
a way of putting in data from a query if it is not included in the query that
the report is based on? I tried putting qryAvgGrades.AvgOffldGradeEarned in
the control source of a text box. Also tried
qryAvgGrades!AvgOffldGradeEarned. No luck either way.
 
F

fredg

I have a report that is working fantastically, except that I want a subtotal
in a group footer and a grand total in a page footer. These values come from
queries designed to get them. I couldn't include these queries in the query
that the report is based on because when I did I got duplicate rows. Is there
a way of putting in data from a query if it is not included in the query that
the report is based on? I tried putting qryAvgGrades.AvgOffldGradeEarned in
the control source of a text box. Also tried
qryAvgGrades!AvgOffldGradeEarned. No luck either way.


If the query returns just the one row, you can use DLookUp in an
unbound control on the report.

= DLookUp("[AvgOffldGradeEarned]","qryAvgGrades")
 
S

Serendipity

I am new at this. When I put your formula as the control source of a text
box, the first group (the group with a 10% weight) gave me a correct average
of 91.5 in the footer but the group footer for the other weights also had
91.5 as their average. So I am guessing that I have more than one row in my
qryAvgGrade; however the query lists all of the weights with a correct
average calculation.

fredg said:
I have a report that is working fantastically, except that I want a subtotal
in a group footer and a grand total in a page footer. These values come from
queries designed to get them. I couldn't include these queries in the query
that the report is based on because when I did I got duplicate rows. Is there
a way of putting in data from a query if it is not included in the query that
the report is based on? I tried putting qryAvgGrades.AvgOffldGradeEarned in
the control source of a text box. Also tried
qryAvgGrades!AvgOffldGradeEarned. No luck either way.


If the query returns just the one row, you can use DLookUp in an
unbound control on the report.

= DLookUp("[AvgOffldGradeEarned]","qryAvgGrades")
 
F

fredg

I am new at this. When I put your formula as the control source of a text
box, the first group (the group with a 10% weight) gave me a correct average
of 91.5 in the footer but the group footer for the other weights also had
91.5 as their average. So I am guessing that I have more than one row in my
qryAvgGrade; however the query lists all of the weights with a correct
average calculation.

fredg said:
I have a report that is working fantastically, except that I want a subtotal
in a group footer and a grand total in a page footer. These values come from
queries designed to get them. I couldn't include these queries in the query
that the report is based on because when I did I got duplicate rows. Is there
a way of putting in data from a query if it is not included in the query that
the report is based on? I tried putting qryAvgGrades.AvgOffldGradeEarned in
the control source of a text box. Also tried
qryAvgGrades!AvgOffldGradeEarned. No luck either way.

If the query returns just the one row, you can use DLookUp in an
unbound control on the report.

= DLookUp("[AvgOffldGradeEarned]","qryAvgGrades")

Did you see this line >If the query returns just the one row< ?
You can't expect Access to know which row to return if you don't tell
it.
If the query returns more than one row you have to add a where clause
to the DLookUp to get the correct data.

= DLookUp("[AvgOffldGradeEarned]","qryAvgGrades","[SomeField] = " &
SomeCriteria)

How the where clause is written depends upon the datatype of the
criteria field.

Look up DLookUp in VBA help, as well as
Where clause + Restrict data to a subset of records.
 

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