Dim cmb2 As WinForm.ComboBox = e.Form.Controls("ComboBox7")
Dim str2 As String = e.Form.Controls("ComboBox3").text
Dim str3 As String = e.Form.Controls("ComboBox1").text
Dim lb As String = DataTables("数据总表").GetComboListString("物资分类_总码编制代码")
Dim max As String
Dim idx As Integer
max = DataTables("数据总表").compute(("max(总码)"), "物品类别 = '" & str2 & "' And 库字 = '" & str3 & "'")
If max > "" Then '如果存在最大编号
idx = CInt(max.Substring(2,3)) + 1 '获得最大编号的后三位顺序号,并加1
Else
idx = 1 '否则顺序号等于1
End If
If cmb2.Items.Count = 1 Then
cmb2.Text = lb & Format(idx,"000")
End If
[此贴子已经被作者于2018/4/1 20:44:51编辑过]