query problem

  • Thread starter Thread starter brino
  • Start date Start date
B

brino

hi all!

i have a query that brings out records and groups them by name and then
brings out the last record of each person.
on the name field i have selected "group by".
in the date/time field i have selected "last"
however in the results it produces the first record instead.
if i change the date/time field to "first" it produces the last record.
why is this ? i must be going about this the wrong way or something??

thanks

brino
 
hi all!

i have a query that brings out records and groups them by name and then
brings out the last record of each person.
on the name field i have selected "group by".

Can you in fact assume that you will NEVER have to deal with two
people who happen to have the same name? I know three men named Fred
Brown. It would be better go group by some unique PersonID.
in the date/time field i have selected "last"
however in the results it produces the first record instead.
if i change the date/time field to "first" it produces the last record.
why is this ? i must be going about this the wrong way or something??

The "First" and "Last" Group operators are misleading. They refer to
the first and last records *in disk storage order* - an order that
Access sets for itself and doesn't let you easily control! Using First
is only useful if you simply want one record and don't care which;
I've never found any valid use for Last.

If you want the record most recently entered, you must include some
field within the record to identify it - a sequential autonumber, a
date/time field defaulting to Now(), or the like. What else is in your
table? What constitutes the "last" (or the first) record?

John W. Vinson[MVP]
 
Back
Top