参考:http://www.foxtable.com/webhelp/topics/2481.htm
If e.DataCol.Name = "BoxNo" Then
If e.DataRow.IsNull("地址") = False
Dim dr As DataRow
dr = e.DataTable.Find("BoxNo = '" & e.NewValue & "' and 地址 <> '" & e.DataRow("地址") & "'")
If dr IsNot Nothing Then
MessageBox.Show("BoxNo被别人用了!")
e.Cancel = True
End If
End If
ElseIf e.DataCol.Name = "地址" Then
Dim dr As DataRow
dr = e.DataTable.Find("BoxNo = '" & e.DataRow("BoxNo") & "' and 地址 <> '" & e.NewValue & "'")
If dr IsNot Nothing Then
MessageBox.Show("BoxNo被别人用了!")
e.Cancel = True
End If
End If