没有,如果在下找到原因一定贴上来!
因为数据库建立了前后台与工作组文件,较大不方便传上来
以下代码应可以实现:同年同月从001开始编号,同一LOTNO与同一部品的编号相同,给有类似需求的朋友参考一下,在下花了一上午的时间弄出来的,呵呵
Private Sub Form_Load()
On Error GoTo aa
On Error Resume Next
Dim i, j As Long
Dim b, c, d, e As String
Dim f As Integer
j = Me.RecordsetClone.RecordCount
Me.Recordset.MoveFirst
Me.SendNo = "OQC" & Format(Me.SendDate, "yymm") & "001"
f = 1
For i = 1 To j
If IsNull(Me.SendNo) Then
If Format(Me.SendDate, "yymm") = e Then
If b = Me.LotNo And c = Me.MaterialNo Then
Me.SendNo = d
Else
Me.SendNo = "OQC" & Format(Me.SendDate, "yymm") & Format(f + 1, "000")
f = f + 1
End If
b = Me.LotNo: c = Me.MaterialNo: d = Me.SendNo: e = Format(Me.SendDate, "yymm")
Else
Me.SendNo = "OQC" & Format(Me.SendDate, "yymm") & "001"
f = 1
End If
b = Me.LotNo: c = Me.MaterialNo: d = Me.SendNo: e = Format(Me.SendDate, "yymm")
Else
b = Me.LotNo: c = Me.MaterialNo: d = Me.SendNo: e = Format(Me.SendDate, "yymm")
End If
Me.Recordset.MoveNext
Next
aa:
Exit Sub
End Sub
[此贴子已经被作者于2006-4-5 15:36:45编辑过]
|