|
Private Sub 产品编号_LostFocus()
On Error GoTo err_产品编号_lostfocus:
Dim rs As ADODB.Recordset
Dim strtemp As String
Dim i As Integer
Set rs = New ADODB.Recordset
strtemp = "select * from 产品资料"
rs.Open strtemp, CurrentProject.Connection, adopenkeyset, adlockbatchoptimistic
rs.MoveFirst
For i = 1 To rs.RecordCount
If rs("产品编号") = Me.产品编号 Then
Me.产品名称 = rs("产品名称")
Exit Sub
Else
rs.MoveNext
End If
Next i
Set rs = Nothing
exit_产品编号_lostfocus:
Exit Sub
err_产品编号_lostfocus:
MsgBox Err.Description
Resume exit_产品编号_lostfocus
End Sub |
|