Re: First of and last of help!
From: John Vinson (jvinson_at_STOP_SPAM.WysardOfInfo.com)
Date: 09/06/04
- Next message: mtress: "Totals in select queries"
- Previous message: Alp: "Re: Apostrophe in a text field causes error in query-Thanks"
- In reply to: C Tate: "First of and last of help!"
- Next in thread: C Tate: "Re: First of and last of help!"
- Reply: C Tate: "Re: First of and last of help!"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 06 Sep 2004 12:46:01 -0600
On Mon, 6 Sep 2004 16:27:52 +0100, "C Tate"
<colin@nobodyhere.mrcrtate.fsnet.co.uk> wrote:
>I am a little confused by the 'first of' and 'last of' options when using
>the totals in queries (despite having done a search in this group and
>reading the relevant part of an Access book!).
They ARE confusing.
>I understand that 'last of' for example will take the last 'physical'
>record. I'm not totally sure what that means. Does it mean the last record
>in the table? So, if you took an orders table and queried on a particular
>customer, you would get the last record in that table, not necessarily the
>most recent date?
Not really. Access stores records on your hard disk drive, in a
sequential order. However, the most recently added record is not
necessarily in the last physical "slot" on the disk. It often will be,
but if there is room elsewhere Access will store a new record there.
In addition, the physical order of records gets rearranged if you
compact the database.
Essentially, the First() operator is useful ONLY if you want to
retrieve an arbitrary record's value, and you don't care which. I have
not been able to think of any good reason to use Last() since it also
retrieves an arbitrary, and uncontrollable, record - and must traverse
the entire recordset to do so!
If you want the most recently entered record, you must include a
date/time field in the table and use a query searching for the maximum
value of that date field; you are correct that getting the "last"
record is NOT a reliable way to do this.
John W. Vinson[MVP]
(no longer chatting for now)
- Next message: mtress: "Totals in select queries"
- Previous message: Alp: "Re: Apostrophe in a text field causes error in query-Thanks"
- In reply to: C Tate: "First of and last of help!"
- Next in thread: C Tate: "Re: First of and last of help!"
- Reply: C Tate: "Re: First of and last of help!"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|