Foxtable(狐表)用户栏目专家坐堂 → [求助]求助根据第二个表序列自动编号


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

主题:[求助]求助根据第二个表序列自动编号

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


加好友 发短信
等级:超级版主 帖子:107896 积分:548849 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/12/23 22:51:00 [显示全部帖子]

Dim t As Table = Forms("录入窗口").Controls("Table1").Table
For Each s As String In t.DataTable.SQLGetValues("mid(类别代码,1,2)","类别代码 is not null and len(类别代码) > 1")
    'Dim a As String = s.SubString(0,2)
    Dim max As String = DataTables("商品信息").Compute("Max(商品代码)","商品代码 like '" & s & "%' ")
    Dim id As Integer = 1
    If max > "" Then
        id = cint(max.SubString(2)) + 1
    End If
    For Each dr As DataRow In t.DataTable.Select("类别代码 like '" & s & "%'","")
        dr("商品代码") = s & Format(id,"000000")
        id += 1
    Next
Next

 回到顶部