以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]表达式列,重复的不提示  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=77488)

--  作者:xianzheng
--  发布时间:2015/11/19 10:21:00
--  [求助]表达式列,重复的不提示

[求助]表达式列,重复的不提示

‘发票号’列是表达式列,重复就不提示,需要修改代码吗?

If e.DataCol.Name = "发票号" Then
    Dim dr As DataRow = DataTables("进项发票").Find("发票号 = \'" & e.NewValue & "\'")
    If dr IsNot Nothing Then
        MessageBox.Show("此\'发票号\'已存,不能重复录单!","提醒")
        e.DataRow("发票号") =""
        e.Cancel = True
    End If
End If


--  作者:xianzheng
--  发布时间:2015/11/19 10:22:00
--  

因为我必须用表达式取值,不能用数据列,求助

 


--  作者:xianzheng
--  发布时间:2015/11/19 11:30:00
--  
求助]表达式列,重复的不提示
--  作者:大红袍
--  发布时间:2015/11/19 11:32:00
--  

呃,表达式列,不触发datacolchanging和datacolchanged事件,必须去它的源头(合成表达式的列)写代码

 

http://www.foxtable.com/help/topics/2381.htm

 


--  作者:xianzheng
--  发布时间:2015/11/19 12:20:00
--  

我这样改了,但还是没有用,帮看下

 

If  e.DataCol.name =  "发票号"   Then
    Dim  pr As  DataRow = e.DataRow.GetParentRow("进项发票")  \'找出对应的父行
    If  pr IsNot Nothing Then
        If e.DataCol.Name = "发票号" Then
            DataTables("进项发票").DataCols("发票代码").RaiseDataColChanged(pr)   \'通知系统此父行的数量列发生了改变,触发DataColChanged事件
            DataTables("进项发票").DataCols("发票号码").RaiseDataColChanged(pr)   \'通知系统此父行的数量列发生了改变,触发DataColChanged事件
           
            Dim dr As DataRow = DataTables("进项发票").Find("发票号 = \'" & e.NewValue & "\'")
            If dr IsNot Nothing Then
                MessageBox.Show("此\'发票号\'已存,不能重复录单!","提醒")
                e.DataRow("发票号") =""
                e.Cancel = True
            End If
        End If
    End If
End If


--  作者:xianzheng
--  发布时间:2015/11/19 12:22:00
--  

发票号=发票代码+发票号码

“发票代码”是数据列

“发票号码”是数据列

“发票号”是表达式列


--  作者:xianzheng
--  发布时间:2015/11/19 12:23:00
--  
“发票号”不能重复
--  作者:大红袍
--  发布时间:2015/11/19 12:47:00
--  
以下是引用大红袍在2015/11/19 11:32:00的发言:

呃,表达式列,不触发datacolchanging和datacolchanged事件,必须去它的源头(合成表达式的列)写代码

 

http://www.foxtable.com/help/topics/2381.htm

 

 

不触发事件啊,写了没用。去父表的datacolchanged写代码。