Public Function 重複()
Dim db As Database
Dim t As RecordSet
Dim cnt As Long
Dim w As String
Set db = CurrentDb
Set t = db.OpenRecordSet("SELECT sa.* FROM sa ORDER BY sa.ID sa.key;")
w = ""
cnt = 0
If t.EOF = True Then
MegBox "レコードがありません"
Else
t.MoveFirst
Do Until t.EOF
If t!ID <> w Then
w = t!ID
Else
t.Edit
t!フラグ = "1"
t.Update
cnt = cnt + 1
End If
t.MoveNext
Loop
End If
MsgBox "重複データ" & cnt & "件"
t.Close
db.Close
Set t = Nothing
Set db = Nothing
End Function
0 件のコメント:
コメントを投稿