以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  编辑问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=183853)

--  作者:wlj88868
--  发布时间:2022/11/16 11:22:00
--  编辑问题

下面的代码运行老是提示2次,我想要符合条件的正常输入,,不符合条件的返回重新编辑鼠标返回到二维码行,请老师给看一下,需要怎么改一下

 

If e.DataCol.Name = "所属部门" OrElse e.DataCol.Name = "二维码"Then
    Dim dr As DataRow
    Dim Filter As String
    Filter = "[所属部门] = \'" & e.DataRow("所属部门") & "\' And [二维码] = \'" & e.DataRow("二维码") & "\'"
    dr = DataTables("出库明细").SQLFind(Filter) \'在行政区域表查找所输入省市和县市的行
 If dr Is Nothing Then \'如果没有找到
    e.DataRow("二维码") = Nothing
    e.DataRow("条码") = Nothing
    Messagebox.show("二维码或条码不存在,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
    e.Cancel = True
End If
End If


--  作者:有点蓝
--  发布时间:2022/11/16 11:24:00
--  
放到datacolchanging事件,把下面2句去掉
    e.DataRow("二维码") = Nothing
    e.DataRow("条码") = Nothing

--  作者:wlj88868
--  发布时间:2022/11/16 12:46:00
--  

老师我这里是判断2个列的,,但是输入2维码就提示了,不是这2列都输完才判断的,,麻烦再给提示一下

 


--  作者:有点蓝
--  发布时间:2022/11/16 13:29:00
--  
参考:http://www.foxtable.com/webhelp/topics/2481.htm
--  作者:wlj88868
--  发布时间:2022/11/16 15:15:00
--  

还得麻烦老师给看一下,,不会提示

 

Select Case e.DataCol.name
    Case "二维码", "所属商场"
        Dim xh As String
        Dim gg As String
        If e.DataCol.Name = "二维码" Then
            xh = e.NewValue
            gg = e.DataRow("所属商场")
         Else
            gg = e.NewValue
            xh = e.DataRow("二维码")
         End If
        If xh > "" AndAlso gg > "" Then
            Dim dr As DataRow
            Dim Filter As String
            Filter = "[所属商场] = \'" & e.DataRow("所属商场") & "\' And [二维码] = \'" & e.DataRow("二维码") & "\'"
            dr = DataTables("出库明细").SQLFind(Filter) \'在行政区域表查找所输入省市和县市的行   
            If e.DataTable.Find("型号 = \'" & xh & "\' And  规格 = \'" & gg & "\'") IsNot Nothing Then
                MessageBox.Show("库存二维码不存在,请查是否已出库!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
                 e.Cancel = True
            End If
        End If
 End Select


--  作者:wlj88868
--  发布时间:2022/11/16 15:19:00
--  
isnot不会提示,,,去掉not正确的也提示,到底是错在那个位置
--  作者:有点蓝
--  发布时间:2022/11/16 15:33:00
--  
Dim Filter As String
Filter = "[所属商场] = \'" & gg  & "\' And [二维码] = \'" & xh & "\'"
            dr = DataTables("出库明细").SQLFind(Filter) \'在行政区域表查找所输入省市和县市的行   
            If dr is Nothing Then
                MessageBox.Show("库存二维码不存在,请查是否已出库!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
                 e.Cancel = True
            End If