以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]自动连续按选定的编号增行赋值 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=153701) |
-- 作者:宝宝猪jerry -- 发布时间:2020/8/20 3:27:00 -- [求助]自动连续按选定的编号增行赋值 If CurrentTable.Name = "loc.Rep_gd.Rep_bg" Then Dim t1 As String = e.Form.Controls("TextBox1").Text Dim tl As Integer = t1.Length Dim t2 As String = t1.SubString(0,3) Dim nm As Integer = e.Form.Controls("NumericComboBox1").Value Dim idx As Integer If nm > 1 And nm < 10 Then Dim i As Integer Dim test As String For i = 1 To nm idx = CInt(t1.Substring(3)) + i If tl = 7 Then test = t2 & format(idx,"0000") \'如何增行后在报告编号单元格内赋值呢? End If If tl = 8 Then test = t2 & format(idx,"00000") \'如何增行后在报告编号单元格内赋值呢? End If If tl = 9 Then test = t2 & format(idx,"000000") \'如何增行后在报告编号单元格内赋值呢? End If If tl = 10 Then test = t2 & format(idx,"0000000") \'如何增行后在报告编号单元格内赋值呢? End If Next Else Messagebox.Show("最多自增10个报告编号!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If Else Messagebox.Show("请选择需自增号的报告编号!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If [此贴子已经被作者于2020/8/20 3:30:56编辑过]
|
-- 作者:有点蓝 -- 发布时间:2020/8/20 9:07:00 -- …… If nm > 1 And nm < 10 Then idx = CInt(t1.Substring(3)) Dim r As Row For i = 1 To nm idx = idx +1 test = t2 & format(idx,"0000") r = CurrentTable.AddNew r("报告编号") = test Next Else …… |
-- 作者:宝宝猪jerry -- 发布时间:2020/8/26 9:03:00 -- 搞定了,谢谢老师 |