DAngelia said:
Joe,
The reason for the 'Max' is that I would like to see the last
PayeeDate (info) for each record.
The reason for ChkNum1, ChkNum2 and ChkAmt1, ChkAmt2. I keep track of
how many checks are written on a weekly basis for my church.
We can write up to two checks per week for a particular category. For
instance if we have a Church-Program on a Sunday morning and evening
the same day and we have to pay two different musician's we have to
write two different checks. I have a comment field that I list the
name of whom the check was made payable to. I didn't want to have to
keep a separate 'PayeeName' for each person the check is being
written to because we may sometime only have to pay a particular
person once or twice for the year.
This is what I want my report to look like each week:
PayeeName PayeeDate ChkNum1 ChkAmt1 ChkNum2 ChkAmt2 Comment
Musician 9/15/05 121 50.00
Somebody
Pastor 9/15/05 336 100.00 445
200.00 TK & SA
Choir 9/15/05 446 50.00 558
100.00 RF & GAA
I would like to have the weekly total and year-to-date total listed
also.
The PayeeDate will always be the 'MaxDate' that's why I used it. The
weekly total will reflect those records related to the 'MaxDate'. The
year-to-date total will be all for the year thus far. I just wanted
to make sure that the Weekly and YTD Totals will reset to zero for
the coming year.
I'm sorry for being so long with my explanation. Hope this helps.
Thanks! Thanks! Thanks!
Here is an example of one using a table in a database I'm using. Now this is
the SQL from the query. The table is constructed as show below.
LEDGER Table
Transaction
PaymentDate
PaymentAmount
Now the query below would only show me from 1/1/05 to Today and nothing for
2004 at all.
SELECT Month([PaymentDate]) AS Mt, LEDGER.Transaction, LEDGER.PaymentDate,
Sum(LEDGER.PaymentAmount) AS SumOfPaymentAmount
FROM LEDGER
GROUP BY Month([PaymentDate]), LEDGER.Transaction, LEDGER.PaymentDate
HAVING (((LEDGER.PaymentDate) Between DateValue("1/1/" & Year(Date())) And
Date()));
Mt is an Expr field setup to get the month totals and help group in a
report. (again no nothing about weekly) here though you would need to setup
some methods for weekly.
Transaction would be like your PayeeNum
PaymentDate your PayeeDate
PaymentAmount your PayAmt (this would be all your payee amounts.
Now as I said before if you use the BETWEEN DateValue("1/1"&Year(Date()))
And Date())) under the criteriea field it will only work with dates from
1/1/05 to Today. As of Jan 1, 2006 it will only show dates from 1/1/06 to
what ever day after 1/1/06 you run the query. I hope that is clearer.
I sorry I still don't understand the need for the MaxDate as this would give
all data in the date span required.