Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use a field in previous record

Status
Not open for further replies.

JUANCARLOS

Programmer
Oct 30, 2000
61
0
0
PE
In a report i need how to obtain that te value in field copyin the next record in field A (no relation matematic beetwing Field A and C)

Thx in advance i have the folowing situation:

Field A Field B Field C
10 20 85.25 ---> go in the next line
80.25 10 90.89 ---> go in the next line
90.89 70 54.26 ---> go in the next line
54.26 60 26.25 ---> go in the next line
26.25

Pls help




 
Pls the only thing i need is:

Field1 Field2 Fiel3

10 20 30 This value go to the field 1 in the next record

30 10 20

20 15 15

15 20 5 and so go on



 
There is no such thing as a previous in a table. You can not guarantee an order of the records unless you have a field to sort on. The easiest is to have an autoID field or a timestamp.
SELECT (select TOP 1 C from tblOne as Previous where tblOne.ID > Previous.ID order by ID DESC) AS A, tblOne.B, tblOne.C
FROM tblOne;

A B C
20 30
30 10 20
20 15 15
15 20 5

However, this will put null in the first value for A. How can you get 10? There is nothing to carry over from. Makes no sense to me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top