Change field data based off of previous record field (1 Viewer)

KirkComer

Registered User.
Local time
Today, 08:58
Joined
Oct 21, 2005
Messages
50
I know this is probably explained in this forum somewhere but I just can't find exactly what I am looking for.

What I want is to update 2 millisecond time fields bases on a comparision between a current row field and a previous row field. In the attached JPEG I would want the results to reflect a change to two fields like this whenever two start times in records matched. (The records will always be in the A-Z order I need them.)

So in this example...
PressID StartDate StartMsecTime StopMsecTime
782 12/01/2009 26280000 26280000
782 12/01/2009 26280000 26280000

Would be changed to...
PressID StartDate StartMsecTime StopMsecTime
782 12/01/2009 26280000 26280500
782 12/01/2009 26280500 26280000
 

Attachments

  • example picture.jpg
    example picture.jpg
    54.5 KB · Views: 173
  • PreviousRecordExample.mdb
    312 KB · Views: 149

KirkComer

Registered User.
Local time
Today, 08:58
Joined
Oct 21, 2005
Messages
50
I am working in MS Access 2003... in case that makes any difference.
 

geoffcodd

Registered User.
Local time
Today, 13:58
Joined
Aug 25, 2002
Messages
87
Maybe something along these lines

Dim db As Database
Dim rs As Recordset
Dim i As Integer
Dim sValue As String

i = 0

Set db = CurrentDb
Set rs = db.OpenRecordset("tbl_PreviousRowExample")

rs.MoveFirst
Do Until rs.EOF

If (i <> 0) Then

rs.Edit
rs!StartMsecTime = sValue
rs.Update

End If

sValue = rs!StopMsecTime

i = i + 1

rs.MoveNext
Loop
rs.Close
 

Users who are viewing this thread

Top Bottom