Finding a previous line

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table with a bunch of currency fields and an autonumber primary key.
I have a query which takes the ID of the record being currently used in the
form, subtracts one (to get the line before) and then gives the value of a
particular field, showing me the value of the a field in the record previous.
However, this obviously only works if no ID numbers have been skipped, if no
line has been deleted. Can anyone help me with the formula I'd use or method
to get the value of the field in the record prior, even if the ID number of
that prior record isn't current ID-1?

TIA,
Emma
 
Emmweb said:
I have a table with a bunch of currency fields and an autonumber
primary key. I have a query which takes the ID of the record being
currently used in the form, subtracts one (to get the line before)
and then gives the value of a particular field, showing me the value
of the a field in the record previous. However, this obviously only
works if no ID numbers have been skipped, if no line has been
deleted. Can anyone help me with the formula I'd use or method to get
the value of the field in the record prior, even if the ID number of
that prior record isn't current ID-1?

TIA,
Emma

Do a SELECT TOP 1 query sorting in descending order on the ID field with a
criteria of < ID on the form.
 
Ok, so now let's say I want to show *each* line's previous line's field, not
just the previous line's field for just the one record. Any reasonable way to
go about that?
 

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