Now that I know the name of your existing query, the new
query would be:
SELECT RSM, Sum([Sales Opportunity]) As TotalOpportunity,
Sum([Sales Converted]) As TotalConverted
FROM DateRangeQuery
GROUP BY RSM
You should understand that the wizards only give you a
helping hand and that you frequently will need to modify
what a wizard generates to do exactly what you need.
Another important point is that the query designer is just a
semi graphical interface for creating a query, it is not the
query. The real query is the SQL statement that the query
designer creates from what you enter in the design grid. To
see the SQL statement you can use the View menu's SQL View
menu item.
Since the query design grid is rather difficult to express
in a text news group message, the standard is to post a
Copy/Paste of the SQL statement (i.e. the query's SQL view).
To create a query from my posted SQL statement, Create a
new query and immediately switch to SQL view and then Copy
the SQL statement I posted and Paste it over the top of
whatever Access put there in its attempt to help you get
started. To see how the SQL statement could be entered in
the query designer, switch back to design view.
It would be a good homework assignment for you to study all
of your queries in both design and SQL view. You shouldn't
find it too difficult to gain an elementary understanding of
SQL, which is a good thing because the wizards are not all
that smart. The query designer can not be used to express
even moderately complex queries so, sooner rather than
later, you will need to use SQL directly.
--
Marsh
MVP [MS Access]
Ok, I understand that I need a new query and that I need to use that query to
generate what will be a sub-report in my existing report. Where I am lost is
how to create a query using the data string you provided. The only ways I
have done queries is using the wizard or in design view pulling fields from
specific tables. I attempted to make a query that totaled these fields for
me, but had no success. I got an error that said I tried to execute a query
that does not include the specified expression 'RSM' as part of an aggregate
function. I have no idea what that means. Do I have to place the data
string you provided in the code builder? I'm sure it's frustrating having to
deal with such a novice, but I really appreciate the help.
The current report's data source is DateRangeQuery. I built this query with
the wizard and simply added "Between [Enter Start Date] and [Enter End Date]"
into the criteria for the Date Recieved field.
Marshall Barton said:
I'm not sure that I am getting the idea across. Let's say
you want a report that sumarizes all the Sales Opportunities
and Sales Converted for all RSMs over the same date range as
your existing report. Let's also say that your existing
report's record source query is named qryRSM
Then this new report's record source query would be:
SELECT RSM, Sum([Sales Opportunity]) As TotalOpportunity,
Sum([Sales Converted]) As TotalConverted
FROM qryRSM
GROUP BY RSM
Run this query and make sure it displays all the required
summary totals for all the RSMs.
Next, create a new report based on the new query. This new
report would have only the detail sction with three text
boxes bound to the RSM, TotalOpportunity and TotalConverted
fields. Preview this summary report to make sure it looks
the way you want. When you have it displaying the way you
want, close and save it. Then drag and drop it from the db
window into your existing report's header section.
If all that works and you need more help specifying the date
range, post back with a Copy/Paste of the main report's
record source query.