|
全部のモジュールを書いておきます。
Dim cn As ADODB.Connection
Dim re1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Set cn = Application.CurrentProject.Connection
Set rs1 = New ADODB.Recordset
Set rs2 = New ADODB.Recordset
rs1.Open "T_出張所マスタ", cn, adOpenKeyset, adLockOptimistic
rs2.Open "T_年度予算A", cn, adOpenKeyset, adLockOptimistic
rs1.MoveFirst
Do Until rs1.EOF
rs2.Find "'期' & '出張所CD' ='" & rs1!期 & rs1!出張所CD & "'"
If rs2.EOF Then
rs2.AddNew
rs2![期] = rs1![期]
rs2![出張所CD] = rs1![出張所CD]
rs2.Update
End If
rs2.MoveNext
Loop
rs1.Close
rs2.Close
cn.Close
|
|