批量录入时,如果有重复(3列)时停止录入,以下代码不起作用。
Select Case e.DataCol.name
Case "发货单号","产品代码","颜色"
Dim fh As String
Dim cp As String
Dim ys As String
If e.DataCol.Name = "发货单号" Then
fh = e.NewValue
cp = e.DataRow("产品代码")
ys = e.DataRow("颜色")
ElseIf e.DataCol.Name = "产品代码" Then
cp = e.NewValue
fh = e.DataRow("发货单号")
ys = e.DataRow("颜色")
ElseIf e.DataCol.Name = "颜色" Then
ys = e.NewValue
fh = e.DataRow("发货单号")
cp = e.DataRow("产品代码")
End If
If fh > "" AndAlso cp > "" AndAlso ys > "" Then
Dim dr As DataRow = e.DataRow
If e.DataTable.Find("发货单号 = '" & fh & "' And 产品代码 = '" & cp & "'And 颜色 = '" & ys & "'") IsNot Nothing Then
'Tables("销售发货.销售发货明细").Current.Delete
MessageBox.Show("不要重复录入!","提示")
Return
'e.Cancel = True
End If
End If
End Select