Foxtable(狐表)用户栏目专家坐堂 → 为什么代码不起作用


  共有3306人关注过本帖平板打印复制链接

主题:为什么代码不起作用

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/6/15 10:43:00 [只看该作者]

Select Case e.DataCol.name
    Case "物料代码"
        If e.newvalue Is Nothing Then '如果新值是空白,也就是物料代码列的内容为空
            ' msgbox("物料代码为空")
            e.DataRow("出库数量") = Nothing '那么清空此行出库数量列的内容
        Else
            Dim dg As DataRow = DataTables("库存材料表").Find("[物料代码] = '" & e.NewValue & "'","_Identify Desc")'获得最后一行
            If dg Is Nothing Then '如果找到了同名的物料代码行,也就是dr不是Nothing
                'msgbox("在库存没找到物料")
                'e.Cancel = True
                e.NewValue = Nothing
            Else
               
                If e.DataRow("出库数量") <= 0 Then
                    e.DataRow("出库数量") = Nothing
                ElseIf  e.DataRow("出库数量") >= dg("库存数量") Then
                    'MsgBox("出库量不能大于库存量!")
                    e.DataRow("出库数量") = dg("库存数量")
                End If
            End If
        End If
    Case "出库数量"
        Dim dg As DataRow = DataTables("库存材料表").Find("[物料代码] = '" & e.DataRow("物料代码") & "'","_Identify Desc")'获得最后一行
        If dg Is Nothing Then '如果找到了同名的物料代码行,也就是dr不是Nothing
            'msgbox("在库存没找到物料")
            'e.Cancel = True
            e.NewValue = Nothing
        Else
           
            If e.newvalue <= 0 Then
                e.newValue = Nothing
            ElseIf  e.newvalue >= dg("库存数量") Then
                'MsgBox("出库量不能大于库存量!")
                e.newvalue = dg("库存数量")
            End If
        End If
       
End Select


 回到顶部
总数 24 1 2 3 下一页