I need to find a record and move back one record. The code I have listed below works great but sometimes the previous record doesn't have an address in the [Address] field so I need to move back one more record. I've been playing with the code listed below to see if I can say 'if the [Address] field is blank move back one more record but I can't seem to get it to work. Any suggestions?
Dim MyAdj, i As Variant
Dim RS As DAO.Recordset
Set RS = CurrentDb.OpenRecordset("APS Import Test")
Dim STRField As String
'For i = 1 To RS.RecordCount
RS.MoveFirst
For i = 2 To RS.RecordCount
If i = 1 Then
RS.MoveFirst
Else
RS.MoveNext
End If
If (RS.Fields("Adjustments ").Value) <> " " Then
With RS
.Edit
MyAdj = .Fields("Adjustments ").Value
.Update
.MovePrevious
.Edit
.Fields("Adjustments ").Value = MyAdj
.Update
.MoveNext
End With
End If
Next i
Dim MyAdj, i As Variant
Dim RS As DAO.Recordset
Set RS = CurrentDb.OpenRecordset("APS Import Test")
Dim STRField As String
'For i = 1 To RS.RecordCount
RS.MoveFirst
For i = 2 To RS.RecordCount
If i = 1 Then
RS.MoveFirst
Else
RS.MoveNext
End If
If (RS.Fields("Adjustments ").Value) <> " " Then
With RS
.Edit
MyAdj = .Fields("Adjustments ").Value
.Update
.MovePrevious
.Edit
.Fields("Adjustments ").Value = MyAdj
.Update
.MoveNext
End With
End If
Next i