我給我的例子您看看了。
先把您要追求的字段用一個生成表查詢,生成一個表,臨時用的。
然后看看我的例程。
Private Sub com_update_Click()
On Error GoTo err_this
DoCmd.SetWarnings False
DoCmd.OpenQuery "addUnderFence_createnewtmptable" /*此為生成表查詢名
DoCmd.SetWarnings True
'Dim conn As String
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim conn As New ADODB.Connection
Set conn = CurrentProject.Connection
rs1.Open "tmp1", conn, adOpenForwardOnly
rs2.Open "additemcontentstogood", conn, adOpenKeyset, adLockOptimistic
Do Until rs1.EOF
'Debug.Print rs1.Fields(0).Value; rs1.Fields(1).Value; rs1.Fields(2).Value; rs1.Fields(3).Value
Do Until rs2.EOF
If rs2.Fields("缸號") = rs1.Fields(0).Value Then
rs2.Fields("送辦日期") = rs1.Fields(1).Value
rs2.Fields("客OK") = rs1.Fields(2).Value
rs2.Fields("回復日期") = rs1.Fields(3).Value
End If
rs2.Update
rs2.MoveNext
Loop
rs1.MoveNext
Loop
rs1.Close
Set rs1 = Nothing
rs2.Close
Set rs2 = Nothing
exit_sub:
Exit Sub
err_this:
MsgBox Err.Description
Resume exit_sub
End Sub
[此贴子已经被HG于2002-6-27 16:42:32编辑过]
|