楼主说的没错,我的试用版,一直这样。
用以下代码,就可避免:
BeforeSaveDataRow
Dim str As String = ""
Dim t As Table = CurrentTable
For Each r As Row In t.Rows
For Each c As Col In t.Cols
If c.DataCol.Unique = True AndAlso r.DataRow.IsNull(c.Name) = False AndAlso t.DataTable.Compute("Count([_Identify])",c.Name & " = '" & r.DataRow(c.Name) & "'") > 1 Then
str = str & "第" & r.Index + 1 & "行 " & "第" & c.Index + 1 & "列, "
End If
Next
Next
If str > "" Then
MessageBox.Show(str,"有些列数据不能重复,请检查")
e.Cancel = True
End If