以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  编号的自动输入  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=133912)

--  作者:jinhetian
--  发布时间:2019/4/23 15:02:00
--  编号的自动输入
老师您好,我这里有产品编号格式为012019030412345,后五位数是需要累加。入库时为了方便(一箱机器为六台)包装箱上标为012019030412345-12351。请问怎样在入库窗口上输入起始编号012019030412345和截至编号12351,实现六台机器编号的自动输入?


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20190423145712.png
图片点击可在新窗口打开查看


--  作者:有点甜
--  发布时间:2019/4/23 16:48:00
--  

参考

 

Dim s1 As String = "012019030412345"
Dim s2 As String = "12351"
Dim n As Integer = right(s1, s2.length)
Dim s As String = left(s1, s1.length-s2.length)
For i As Integer = n To s2
    msgbox(s & Format(i, "".PadLeft( s2.length,"0")))
Next


--  作者:jinhetian
--  发布时间:2019/4/24 13:36:00
--  
老师您好!
编码如此修改
Dim s1 As String = e.Form.controls("TextBox1").value
Dim s2 As String = e.Form.controls("TextBox2").value
Dim n As Integer = right(s1, s2.length)
Dim s As String = left(s1, s1.length-s2.length)
For i As Integer = n To s2
    Tables("发货记录").Current("产品批号") = (s & Format(i, "".PadLeft( s2.length,"0")))
Next
e.Form.controls("TextBox1").value=012019030412345
e.Form.controls("TextBox2").value=12351
编码执行后产品批号栏只有一个012019030412351
请问?如何自动记录六个编号?

--  作者:裴保民
--  发布时间:2019/4/24 14:09:00
--  
For i As Integer = n To s2
    Tables("发货记录").AddNew
    Tables("发货记录").Current("产品批号") = (s & Format(i, "".PadLeft( s2.length,"0")))
Next

--  作者:有点甜
--  发布时间:2019/4/24 15:04:00
--  

Dim s1 As String = e.Form.controls("TextBox1").value
Dim s2 As String = e.Form.controls("TextBox2").value
Dim n As Integer = right(s1, s2.length)
Dim s As String = left(s1, s1.length-s2.length)
For i As Integer = n To s2
    Dim nr = Tables("发货记录").AddNew
    nr("产品批号") = (s & Format(i, "".PadLeft( s2.length,"0")))
Next


--  作者:jinhetian
--  发布时间:2019/4/25 16:36:00
--  
谢谢两位老师,问题解决了。