Last functions in Total Row

  • Thread starter Thread starter Jordan
  • Start date Start date
J

Jordan

The way I understand these functions, they will return
the last value entered chronologically from a group of
records. So if I have a autonumber field in this table,
that field should reveal the chronological order in which
the records were added. I have a table called Payments
with a following sample:

PaymentID,ClientID,DateRec,AmtRec
1,1, ,$504
2,1,4/5/04,$50
3,2,3/2/02,$352
4,3,2/3/99,$78
5,2, ,$913

If I create a query grouped by ClientID and the Last
total on DateRec and AmtRec, it gives inconsistent
results. For example, from the above data, it might
return:

ClientID,LastOfDateRec,LastOfAmtRec
1,4/5/04,$50
2,3/2/02,$352
3,2/3/99,$78

For some reason, it doesn't always give the last value.
Does anyone know why this could be or another way to get
the most recently added record value?
 
Actually, the Last functions are pretty useless. Try using Min or Max
instead.
 
Are they unreliable? What's the deal with them? Using a
payments table like the one I sampled here, how else
could I query the latest payment made by a client? The
Min/Max functions don't work for that. Thanks.
 
Are they unreliable?
Very.

What's the deal with them?

They return the last record IN DISK STORAGE ORDER. Since Access will
store records wherever on the disk there is room (which is
*frequently* but not *reliably*) at the end of the table, Last() will
often - BUT NOT RELIABLY - give you the most-recently entered record.
 
Thanks for that explanation. Is there any other way that
I could query the most recent record for a payment a
client has made from a table of payments?
 
What's wrong with using Max, as I suggested in my first post?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)
 
Back
Top