Last functions in Total Row

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?
 
D

Douglas J. Steele

Actually, the Last functions are pretty useless. Try using Min or Max
instead.
 
G

Guest

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.
 
J

John Vinson

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.
 
J

Jordan

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?
 
D

Douglas J. Steele

What's wrong with using Max, as I suggested in my first post?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)
 

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

Top