Problem with Select MAX query

  • Thread starter Thread starter Leo Hamal
  • Start date Start date
L

Leo Hamal

Hello I am a newbie in Access 97.

When I run the query :
SELECT DISTINCTROW MAX (TbTrans1.Date)
FROM TbTrans1
WHERE (((TbTrans1.Date) BETWEEN #01-jan-07# AND #31-jan-07#);
I get the correct date.

When I run the query :
SELECT DISTINCTROW MAX (TbTrans1.Date), (TbTrans1.NewBal)
FROM TbTrans1
WHERE (((TbTrans1.Date) BETWEEN #01-jan-07# AND #31-jan-07#);

I get error message : You tried to execute query that doesn't include the
specified expression 'NewBal' as part of an aggregate function.

When I take out MAX , I do get the full list of all transactions of January
correctly.

Any help would be much appreciated,
Leo.
 
In query design, depress the Total button on the toolbar.
Access adds a Total row to the grid, and puts Group By under NewBal.

If you prefer to work with the SQL statement, add:
GROUP BY TbTrans1.NewBal
 
Allen,

when I add this I get the full list of all transactions of the month
correctly.
But, probably this was not clear in my initial message, I only need the
data for the last date of the month.
That is why I am experimenting with the MAX.

Thanks,
Leo.
 
Back
Top