以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 求助,如何从各表中提取编号作为新编号 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=29031) |
-- 作者:tedat -- 发布时间:2013/2/26 9:41: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 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 Tables("材料名称管理") Dim bh1 As String Dim r1 As Integer = .FindRow("分组名称=t2",.Position + 1, True) If r1 >= 0 Then \'如果找到的话 .Position = r1 bh1 = .Current("分组编号") End If End With \'定位第2组编号 With Tables("材料类别管理") Dim bh2 As String Dim r2 As Integer = .FindRow("分组名称 = t3",.Position + 1, True) If r2 >= 0 Then \'如果找到的话 .Position = r2 bh2 = .Current("分组编号") End If End With \'定位第3组编号 With Tables("材料应用标准管理") Dim bh3 As String Dim r3 As Integer = .FindRow("分组名称 = t4",.Position + 1, True) If r3 >= 0 Then \'如果找到的话 .Position = r3 bh3 = .Current("分组编号") End If End With \'定位第4组编号 With Tables("材料规格型号管理") Dim bh4 As String Dim r4 As Integer = .FindRow("分组名称 = t5",.Position + 1, True) If r4 >= 0 Then \'如果找到的话 .Position = r4 bh4 = .Current("分组编号") End If End With t1 = bh1 & bh2 & bh3 & bh4" Tables("材料信息表").AddNew End If End If |
-- 作者:狐狸爸爸 -- 发布时间: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 |
-- 作者:狐狸爸爸 -- 发布时间:2013/2/26 9:55:00 -- 建议看看: http://www.foxtable.com/help/topics/1284.htm
你错误很多,最好先系统学习帮助: http://www.foxtable.com/help/topics/1058.htm
|
-- 作者:tedat -- 发布时间:2013/2/26 10:09:00 -- 补充请教下,如果我想在输入名称、类别、标准、规格、单位、单价后,编号就自动显示出来,我要怎么做啊? |
-- 作者:tedat -- 发布时间:2013/2/26 10:14:00 -- 谢谢 |
-- 作者:狐狸爸爸 -- 发布时间:2013/2/26 10:19:00 -- 这种问题,最好做个例子,设计好这几个表,输入一些测试数据,然后将文件传上来,举例说明编号规则。 否则别人不好帮你的哦 |
-- 作者:tedat -- 发布时间:2013/2/26 10:22:00 -- 我这个已经做了,就是差无法生成编号啦,感谢指导啊 |