If the query only returns records for a specific date then, you need some
method to return the sum of other dates. This is can be accomplished with
a
subquery or joining to a totals query that returns the totals.
IMO, don't use parameter prompts in your queries. Always use controls on
forms for user interaction. I would create a form (frmPHODates) that has
a
visible text box (txtDate) to enter the date. Use another text box to
calculate the beginning of the month.
Name: txtMthBegDate
Control Source: =[txtDate]-Day([txtDate])+1
Then you totals query would have a criteria under the date field of:
Between [Forms]![frmPHODates]![txtMthBegDate] And
[Forms]![frmPHODates]![txtDate]
Sum or count or whatever your Forecast and Contracts Received fields.
Save the totals query and add it to the record source of your report so
you
can include the aggregated values from the totals query.
--
Duane Hookom
Microsoft Access MVP
Pulling Hair Out said:
SELECT [All CT qry with ADH].Date, [All CT qry with ADH].Forecast, [All
CT
qry with ADH].[Contacts Received]
FROM [All CT qry with ADH];
Above is a simplified example of the query which the report is based
on. On
open, the report will prompt the user for a [Date], the report will
show the
Forecast number for that date along with the MTD total up to the
entered
date. Same with the Contacts Received. How can I tell the MTD total
to only
go to the entered date? Thanks for your help.
:
Sum what "data"? Are there some actual table and field names? Is the
a SQL
view that you could share from the report's record source?
This is an expression that could be used in a report of the Orders
table in
Northwind ot get the MTD freight:
=Sum(Abs([OrderDate] Between ([Enter a single date]-Day([Enter a
single
date]))+1 And [Enter a single date])*[Freight])
--
Duane Hookom
Microsoft Access MVP
:
I have a report with a "Date" column and a "MTD" column. The user
is
prompted to enter a single date. i want the MTD column to sum the
data from
the first of the month (of the date entered) to the date entered.
Currently,
it is summing the whole month. Any ideas? Thanks in advance.