Dlookup Last Record

Posted on 2008-01-24
Medium Priority
Last Modified: 2010-04-21

I have a table "Split" where i want to look up a record.

Record ID |   ExistingWorkOrders |   ToProduce
1                        AB                             12
2                        AB                              4
3                        AB                               2

i'm using dlookup as
=DLookUp("ToProduce","Split","Existingworkorder= '" & [rpworkorder] & "'")

I want to be able to show the last record, or the record with the Min of Qty Produced.

how can i accomplish that?
Question by:repco
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 1000 total points
ID: 20738077
last record == highest recordid?

=DLookUp("ToProduce","Split","Existingworkorder= '" & [rpworkorder] & "' and RecordID = " & DMax("record id", "Split", "Existingworkorder= '" & [rpworkorder] & "' ")  )

Open in new window

LVL 28

Assisted Solution

TextReport earned 1000 total points
ID: 20738082
You can use DMax("ToProduce","Split","Existingworkorder= '" & [rpworkorder] & "'")
Cheers, Andrew

Author Closing Comment

ID: 31424805
You guys a great!!!

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
What to do if a split doesn't fit? Or a bunch of invoice lines must be rounded while the sum must match a total? It takes a little, but - when done - it is extremely easy to implement.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question