答案 0 :(得分:1)
假设数据一致,请考虑:
Sub SetBoxID()
Dim rs As DAO.Recordset, intID As Integer
Set rs = CurrentDb.OpenRecordset("SELECT * FROM Table1 ORDER BY ID")
While Not rs.EOF
If rs!Type = "Box" Then
intID = rs!ID
ElseIf rs!Type = "Desp" Then
rs.Edit
rs!BoxID = intID
rs.Update
End If
rs.MoveNext
Wend
End Sub