You may need to create a function of your own instead of using the DLookup. In the function, you could make a SQL query to find what you need. Depending on how your PK is setup, you might be able to do something like this:
Function GetEndMeter(CurRowID as long) ‘Pass in the current record’s rowid
dim rs as recordset, SQL as string
SQL = “select EndMeter From table Where rowid = (select max(rowid) from table where rowid < ” & CurRowID & “)”
set rs = currentdb().Openrecordset(SQL,dbOpenSnapshot)
if not rs.eof then
GetEndMeter = rs![EndMeter]
How do I implement this answer into my MS 2003 Access database? I created my work inside a query, so should I place it inside a form and use this formula in VBA? Please advise.