Bonediggler1
Technical User
Hi-
I have a table with 3 fields. Field1 will have a value of either 2 or 3. Field2 will have an integer value. Field3 is blank.
I am trying to write code that will loop through the table, and update Field3 based on Field1. Simply put, if Field1 = 2, Field3 equals a parsing of the values in Field2. If Field1 = 3, Field3 should equal the most recent value inputted in Field3 (which would be the value inputted the last time Field1 = 2).
I think the code I have is close (I know the LastUpdated property is wrong). I just don't know how to reference the most recent value of Field3.
With rst
Do Until .EOF
If !Field1 = 2 Then
.Edit
![Field3] = Right(!Field2, 6) & Left(!Field2, 2)
.Update
.MoveNext
ElseIf !Field1 = 3 Then
.Edit
![Field3] = .LastUpdated
.Update
.MoveNext
End If
Loop
End With
Thank you!!
I have a table with 3 fields. Field1 will have a value of either 2 or 3. Field2 will have an integer value. Field3 is blank.
I am trying to write code that will loop through the table, and update Field3 based on Field1. Simply put, if Field1 = 2, Field3 equals a parsing of the values in Field2. If Field1 = 3, Field3 should equal the most recent value inputted in Field3 (which would be the value inputted the last time Field1 = 2).
I think the code I have is close (I know the LastUpdated property is wrong). I just don't know how to reference the most recent value of Field3.
With rst
Do Until .EOF
If !Field1 = 2 Then
.Edit
![Field3] = Right(!Field2, 6) & Left(!Field2, 2)
.Update
.MoveNext
ElseIf !Field1 = 3 Then
.Edit
![Field3] = .LastUpdated
.Update
.MoveNext
End If
Loop
End With
Thank you!!