Foxtable(狐表)用户栏目专家坐堂 → 求助,如何从各表中提取编号作为新编号


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

主题:求助,如何从各表中提取编号作为新编号

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


加好友 发短信
等级:管理员 帖子:47448 积分:251054 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/2/26 9:53:00 [只看该作者]

Dim t1 As String = e.Form.Controls("编号").VALUE
Dim t2 As String = e.Form.Controls("名称").VALUE
Dim t3 As String = e.Form.Controls("类别").VALUE
Dim t4 As String = e.Form.Controls("标准").VALUE
Dim t5 As String = e.Form.Controls("型号").VALUE
Dim t6 As String = e.Form.Controls("单位").VALUE
Dim t7 As Single = e.Form.Controls("单价").VALUE
Dim bh1 As String
Dim bh2 As String
Dim bh3 As String
Dim bh4 As String
Dim dr As DataRow
If DataTables("材料信息表").DataRows.Count = 0 Then
    Tables("材料信息表").AddNew
Else
    If t2 = "" Or t3 = "" Or t4 = "" Or t5 = "" Or t6 = "" Then
        MessageBox.show("请输入完整的材料信息","提示")
        Return
    Else
        '定位第1组编号
        With DataTables("材料名称管理")
            dr = .Find("分组名称= '" & t2 & "'")
            If dr IsNot Nothing Then '如果找到的话
                bh1 = dr("分组编号")
            End If
        End With
        '定位第2组编号
        With DataTables("材料名称管理")
            dr = .Find("分组名称= '" & t3 & "'")
            If dr IsNot Nothing Then '如果找到的话
                bh2 = dr("分组编号")
            End If
        End With
        '定位第3组编号
        With DataTables("材料应用标准管理")
            dr = .Find("分组名称= '" & t4 & "'")
            If dr IsNot Nothing Then '如果找到的话
                bh3 = dr("分组编号")
            End If
        End With
        '定位第4组编号
        With DataTables("材料规格型号管理")
            dr = .Find("分组名称= '" & t5 & "'")
            If dr IsNot Nothing Then '如果找到的话
                bh4 = dr("分组编号")
            End If
        End With
        t1 = bh1 &  bh2  &  bh3  &  bh4
        Dim r As Row = Tables("材料信息表").AddNew
        r("xxx") = t1
    End If
End If

 回到顶部