Private Sub 比较_Click()
Dim rst As ADODB.Recordset
Dim strSQL As String
'-----
strSQL = "SELECT A.OrderId FROM OrderList AS A INNER JOIN kdjl AS B " _
& "ON A.OrderId=B.OrderId ORDER BY A.OrderId"
Set rst = New ADODB.Recordset
With rst
.ActiveConnection = CurrentProject.Connection
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Source = strSQL
.Open
End With
strSQL = ""
If Not rst.EOF Then
Do Until rst.EOF
If strSQL = "" Then
strSQL = rst(0)
Else
strSQL = strSQL & "," & rst(0)
End If
rst.MoveNext
Loop
MsgBox strSQL & "存在重复!"
End If
rst.Close
Set rst = Nothing
End Sub