Board logo

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

作者: hexch24    时间: 2006-11-18 11:21     标题: 上行输入下行会出现相同内容,结果导致重复不能保存

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

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
作者: Nothing    时间: 2006-11-18 13:57

strCriteria 这个变量并没有使用啊

strCriteria = "[客户简称]='" & Me![客户简称] & "'"

rst.Filter = strCriteria




欢迎光临 编程开发论坛 (http://bbs.lihuasoft.net/) Powered by Discuz! 6.0.0