以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于在窗口中禁止重复的问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=123802)

--  作者:aoc103
--  发布时间:2018/8/23 11:49:00
--  关于在窗口中禁止重复的问题
以下是我的代码 
Dim dr As DataRow 
dr = DataTables("tbl_品牌表").Find("品牌名称 = \'" & e.Form.Controls("TextBox1").text & "\'")
If dr IsNot Nothing Then
       e.Form.Controls("TextBox1").Error = "品牌名称已经存在!"
Else If HasError = False Then \'如果没有输入错误,则保存
    r.Save()
    MessageBox.show("保存成功")
    Forms("品牌单").close()
 End If

无论我在TEXTBOX1里填了什么 都显示有重复 不知道是哪里写错了

--  作者:有点蓝
--  发布时间:2018/8/23 11:58:00
--  
到表事件里判断:http://www.foxtable.com/webhelp/scr/2481.htm

如果在窗口判断的,TextBox1不能绑定列,或者改为后台判断:DataTables("tbl_品牌表").sqlFind