Hello All,
I have a table and I'd like it to Show value of previous record in current
record f.e
ID amnt prv amnt
1 100 100
2 234 100
3 512 234
4 67 512
etc etc, is this possible?
Thanks in advance!
Just for clarity: what do you mean by "the previous record"? Access Tables are
NOT like spreadsheets; there is no inherent order to the records. In addition,
if the ID is an Autonumber, you're not guaranteed to have sequential numbers.
That said... your table should *not* contain the [prv amnt] as a field. If you
store a number in record 4, and subsequently edit the Amt in record 3, the
[Prv amnt] field in record 4 will now be WRONG with no automatic way to detect
the error. Instead, use a Query to look up the previous amount. A Subquery
will do this; create a new query, select View... SQL, and copy and paste this
into the SQL window:
SELECT ID, [Amnt], (SELECT X.[Amnt] FROM yourtable AS X WHERE X.ID = (SELECT
Max(Y.[ID]) FROM yourtable AS Y WHERE Y.ID < X.ID)) AS [Prv Amnt]);