A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Last functions in Total Row



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2004, 10:45 PM
Jordan
external usenet poster
 
Posts: n/a
Default Last functions in Total Row

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?
  #2  
Old May 27th, 2004, 11:06 PM
Douglas J. Steele
external usenet poster
 
Posts: n/a
Default Last functions in Total Row

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

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Jordan" wrote in message
...
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?



  #3  
Old May 27th, 2004, 11:37 PM
external usenet poster
 
Posts: n/a
Default Last functions in Total Row

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.

-----Original Message-----
Actually, the Last functions are pretty useless. Try

using Min or Max
instead.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Jordan" wrote in

message
...
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?



.

  #4  
Old May 28th, 2004, 04:20 AM
John Vinson
external usenet poster
 
Posts: n/a
Default Last functions in Total Row

On Thu, 27 May 2004 15:37:36 -0700,
wrote:

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.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
  #5  
Old May 28th, 2004, 04:27 PM
Jordan
external usenet poster
 
Posts: n/a
Default Last functions in Total Row

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?

-----Original Message-----
On Thu, 27 May 2004 15:37:36 -0700,
wrote:

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.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
.

  #6  
Old May 28th, 2004, 10:52 PM
Douglas J. Steele
external usenet poster
 
Posts: n/a
Default Last functions in Total Row

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

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Jordan" wrote in message
...
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?

-----Original Message-----
On Thu, 27 May 2004 15:37:36 -0700,
wrote:

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.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:24 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.