Access 2007 - Need YTD AND Monthly Info From Query

P

Pam

I have a query that pulls information from a Contributor table and a linked
query (queries for ID, date and amount of contribution). This query asks for
user input of year and date. I would also like to be able to pull YTD
information in a seperate field. All of this gets written to a receipt to
each person on the contributor list (table). I've tried doing another query
for YTD based on the year and joining that with the 1st table and query.
However, when I run it, it asks the user for YYYY and then MM and then YYYY
again. If I put this information in, the query runs, but information is
missing. There are no contibution amounts for some contributors that should
be there and ALL of the monthly amounts are missing

My questions are ... is there any way to "capture" that year information
when the user inputs it the first time? Instead of making another query and
joining it to the others, can this be done directly on the resulting page
(report) itself?

Here is the sql for the main query (qryMonthlyLettersMain):

SELECT DISTINCTROW Format$([qryMonthlyLettersSub].[ContributionDate],'mmmm
yyyy') AS [ContributionDate By Month], tblContributor.ContributorID,
tblContributor.Account, tblContributor.[OneTimeContributor?],
tblContributor.[Inactive?], tblContributor.Addressee,
tblContributor.Address1, tblContributor.Address2, tblContributor.City,
tblContributor.State, tblContributor.Zip, Sum(qryMonthlyLettersSub.Amount) AS
[Sum Of Amount]

FROM tblContributor LEFT JOIN qryMonthlyLettersSub ON
tblContributor.ContributorID = qryMonthlyLettersSub.ContributorID

GROUP BY Format$([qryMonthlyLettersSub].[ContributionDate],'mmmm yyyy'),
tblContributor.ContributorID, tblContributor.Account,
tblContributor.[OneTimeContributor?], tblContributor.[Inactive?],
tblContributor.Addressee, tblContributor.Address1, tblContributor.Address2,
tblContributor.City, tblContributor.State, tblContributor.Zip,
qryMonthlyLettersSub.ContributorID;

and the sql for qryMonthlyLettersSub:

SELECT tblReceipts.ContributorID, tblReceipts.ContributionDate,
tblReceipts.Amount
FROM tblReceipts
WHERE
(((tblReceipts.ContributionDate)>=DateSerial([EnterTheYearYYYY],[EnterTheMonth1to12],1)
And
(tblReceipts.ContributionDate)<DateSerial([EnterTheYearYYYY],[EnterTheMonth1to12]+1,1)));
 

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

Similar Threads


Top