发新话题
打印

[VB资源] 上行输入下行会出现相同内容,结果导致重复不能保存

上行输入下行会出现相同内容,结果导致重复不能保存

编辑内容如下,请指点错误,最好是能给我这个新手说一说里面的一些意思,谢谢啊!

Private Sub 客户简称_BeforeUpdate(Cancel As Integer)
Dim conn As New ADODB.Connection
Set conn = CurrentProject.Connection
Dim rst As New ADODB.Recordset
Dim msg As String
Dim ml As String
Dim strCriteria As String
rst.Open "客户资料", conn, adOpenKeyset, adLockOptimistic
strCriteria = "[客户简称]=" & Me![客户简称] & ""
If rst.EOF Then
Cancel = 0
Else

msg = "你输入客户简称已存在,请修正!"
    m = MsgBox(msg, vbExclamation)
    Cancel = 1
  End If

End Sub

TOP

发新话题