I have been sent a table that holds all our call details by day
i need to be a ble to check each record and if the next record in the table is the same then i need to update a field in my table [DuplicateFlag] with the word "duplicate" i have come up with the following that i seems to work except when updating the field it updates duplicate flag for all records in my table and not just the matching record
hope some can help
Private Sub Command0_Click()
Dim rst As Recordset
Dim strCLI As String
Set db = CurrentDb()
Set rst = db.openrecordset("tbl08006007008thmarch", dbopendynaset)
rst.MoveFirst
Do While Not rst.EOF
strCLI = rst!CLi
rst.MoveNext
If strCLI = rst!CLi Then
DoCmd.RunSQL "UPDATE tbl08006007008thmarch " & _
"SET tbl08006007008thmarch.DuplicateFlag= '" & "Duplicate" & "'"
Else
End If
Loop
rst.Close
End Sub
i need to be a ble to check each record and if the next record in the table is the same then i need to update a field in my table [DuplicateFlag] with the word "duplicate" i have come up with the following that i seems to work except when updating the field it updates duplicate flag for all records in my table and not just the matching record
hope some can help
Private Sub Command0_Click()
Dim rst As Recordset
Dim strCLI As String
Set db = CurrentDb()
Set rst = db.openrecordset("tbl08006007008thmarch", dbopendynaset)
rst.MoveFirst
Do While Not rst.EOF
strCLI = rst!CLi
rst.MoveNext
If strCLI = rst!CLi Then
DoCmd.RunSQL "UPDATE tbl08006007008thmarch " & _
"SET tbl08006007008thmarch.DuplicateFlag= '" & "Duplicate" & "'"
Else
End If
Loop
rst.Close
End Sub