Foxtable(狐表)用户栏目专家坐堂 → 求关联表增行时的明细号代码


  共有2457人关注过本帖树形打印复制链接

主题:求关联表增行时的明细号代码

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/11/13 20:19:00 [显示全部帖子]

datacolchanged事件

 

If e.DataCol.name = "第一列" Then
   
    Dim bh As String = e.DataRow("第一列")
    Dim max As String
    Dim idx As Integer
    max = e.DataTable.Compute("Max(第二列)","第二列 like '" & bh & "-%' and [_Identify] <> " & e.DataRow("_Identify"))
    If max > "" Then '如果存在最大编号
        idx = CInt(max.Substring(bh.length+1)) + 1 '获得最大编号的后三位顺序号,并加1
    Else
        idx = 1 '否则顺序号等于1
    End If
    e.DataRow("第二列") = bh & Format(idx,"-000")
   
End If


 回到顶部