calculate Sum of group of records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I try to get a total of the amount received till a certain month which I
enter on my Form as number. I make a querry as follows, but it returns wrong
values. What am I doing wrong here?

SELECT Sum(T_RECEIVED.[Amount in VND]) AS [SumOfAmount in VND]
FROM T_RECEIVED
HAVING (((Month([Date]))<(Forms!SPENT!MNO)));

Seems like the confusion comes from being not able to distinguish months
No.1, 10, 11, 12. How could this be fixed?

Thank you.
Lana
 
Lana,

With a 99% certainty, your problem is due to the fact that you are using a
date field named "Date"; Date is a reserved Access keyword, specifically a
built-in function which returns the current system date. Change the name od
the field to something different, e.g. PmtDate or something, in your table
design and everywhere else it appears.

HTH,
Nikos
 
Try:
SELECT Sum(T_RECEIVED.[Amount in VND]) AS [SumOfAmount in VND]
FROM T_RECEIVED
WHERE Month([Date])<Val(Forms!SPENT!MNO);
 
Back
Top