Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page