Updating record from previous record details

MrTibbs

Registered User.
Local time
Today, 08:55
Joined
Oct 10, 2001
Messages
101
1 table, 1.5million records,
login
information
date (mostly blank)
Reading down the table we see a login date combination followed by several login information records.
We wish to add the date to each information line, resetting date to blank on each change of login and changing date if the date field is already populated, so we can easily see which login accessed information on a specific date.
How may we associate a date with a variable number of following records?
 
Use DAO objects to traverse the entire table, and modify field values as needed. Your code might look something like this:

Sub FixTable
Dim dbs as Database, rst as Recordset
Set dbs = Currentdb
Set rst = dbs.OpenRecordset("MyTable")
Do While Not rst.EOF
<do necesary calculations and comparisons>
If (<whatever condition> ) Then
rst.Edit
rst![FieldName] = <new value>
rst.Update
End If
<compute/save values for next loop iteration>
rst.MoveNext
Loop
Set rst = Nothing
Set dbs = Nothing
End Sub

[This message has been edited by AlanS (edited 05-28-2002).]
 
AlanS code works - thank you

AlanS,

Your code example pointed me in the right direction and enabled me to solve some otherwise awkward problems both then and now.

Thank you :)
 

Users who are viewing this thread

Back
Top Bottom