作者: kangking 时间: 2012-4-1 22:55
Private Sub Command4_Click()
Dim rsS As Recordset
Dim rsO As Recordset
Dim isFind As Boolean
On Error Resume Next
Set rsS = Me.FBSUB.Form.RecordsetClone
Set rsO = Me.FBLSUB.Form.RecordsetClone
rsS.MoveFirst
Do Until rsS.EOF
isFind = False
rsO.MoveFirst
If Not IsNull(rsS("SN")) Then
rsO.FindFirst "SN ='" & rsS("SN") & "'"
If rsO.NoMatch Then
MsgBox rsS("SN") & " No Match"
End If
Else
MsgBox "SN is null"
End If
rsS.Move 1
Loop
Set rsS = Nothing
Set rsO = Nothing
End Sub作者: 春秋 时间: 2012-4-2 06:52
看了,不是很明白您的意思。一般讲,订单号是唯一的,而SN也应该是唯一的。也就是说,订单号不同而SN相同是一种错误。如果情况确如描述,则应该在输入有效性中加以限定,不必反过来进行检查。像现在这样的设计思路,既增加了难度,又不符合要求。试想,如果数据很庞大,执行一次比较将是多么耗时。作者: lqp971 时间: 2012-4-2 15:55