Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Using last function against date returning results based on key

Discussion in 'Information Technology' started by keliie@yahoo.com, Jul 28, 2006.

  1. keliie@yahoo.com

    keliie@yahoo.com
    Expand Collapse
    Guest

    Hi - simple question I hope someone can help with.

    I am constructing a query that values inventory counts. I want to value
    the inventory based on the last invoice for each piece of inventory.

    I am using the last function in conjunction with the Date field.
    However, my results are returning the last invoice entered (which at
    times is not the last invoice based on date). This is due to the
    unfortunate problem that the last function is being applied against the
    Key field, rather than the Date field.

    Does anyone have a simple work around that they can share for what I
    assume is a basic issue?

    Thanks in advance.

    Kelii
     
  2. Loading...


  3. Larry Linson

    Larry Linson
    Expand Collapse
    Guest

    Not knowing how you keep your data, I can't be very specific, but instead of
    "Last", you need to select based on the max of Date/Time within the Group.

    Larry Linson
    Microsoft Access MVP

    <keliie@yahoo.com> wrote in message
    news:1153362474.390886.136570@s13g2000cwa.googlegroups.com...
    > Hi - simple question I hope someone can help with.
    >
    > I am constructing a query that values inventory counts. I want to value
    > the inventory based on the last invoice for each piece of inventory.
    >
    > I am using the last function in conjunction with the Date field.
    > However, my results are returning the last invoice entered (which at
    > times is not the last invoice based on date). This is due to the
    > unfortunate problem that the last function is being applied against the
    > Key field, rather than the Date field.
    >
    > Does anyone have a simple work around that they can share for what I
    > assume is a basic issue?
    >
    > Thanks in advance.
    >
    > Kelii
    >
     
  4. John Vinson

    John Vinson
    Expand Collapse
    Guest

    On 19 Jul 2006 19:27:54 -0700, keliie@yahoo.com wrote:

    >I am using the last function


    Don't. It's very misleading. It returns the last record *in disk
    storage order* - an order which is arbitrary and uncontrollable.

    Use the Max() function instead.

    John W. Vinson[MVP]
     
  5. keliie@yahoo.com

    keliie@yahoo.com
    Expand Collapse
    Guest

    Larry, John:

    Thanks for the reply, suggestions works perfectly.

    Best,

    Kelii
     

Share This Page