我的扫描程序在扫描序列号并从位置12的5位数字中查找运行编号时遇到此错误。但是,当位置12的数字为9时,它将显示运行时错误。我不确定是什么原因造成的。我希望有人能帮帮忙。谢谢。当我扫描一个数字(例如Z121564182690072 C)时发生错误,它将接受然后输入,但是当我扫描第二个输入Z121564182690073 C时,它将显示错误。我认为问题出在此代码附近。
Case -1 'Scanned UUT is 1 more than a number in the list
'if sample size is more than half of the lot size then skip checking
If (CLng(Me.lblRequiredQty.Caption) / CLng(Me.txtLotQty.Text)) < (2 / 3) Then
If CLng(Me.lblRequiredQty.Caption) > 10 Then
If i < Me.lstUnit.ListCount - 1 Then
If CLng(CLng(Mid(Me.lstUnit.List(i + 1), 12, 5)) - CLng(Mid(Me.lstUnit.List(i), 12, 5))) = 1 Then
Me.lstUnit.Selected(i) = True
A = MsgBox("This unit serial number is in sequence with " & _
Me.lstUnit.List(i) & " and " & Me.lstUnit.List(i + 1) & "!", vbExclamation, "Error!!!")