Using last function against date returning results based on key

  • Thread starter Thread starter keliie
  • Start date Start date
K

keliie

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
 
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
 
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]
 
Larry, John:

Thanks for the reply, suggestions works perfectly.

Best,

Kelii
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top