次の例では、社員のレコードで現在 2 に設定されている ReportsTo フィールドの値をすべて 5 に変更します。
Sub UpdateX()
Dim dbs As Database
Dim qdf As QueryDef
'
この下の行を、使用しているコンピュータ上の
' Northwind
のパスに変更してください。
Set dbs = OpenDatabase("Northwind.mdb")
'
社員のレコードで現在 2
に設定されている
' ReportsTo
フィールドの値をすべて
' 5
に変更します。
dbs.Execute "UPDATE Employees " _
& "SET ReportsTo = 5 " _
& "WHERE ReportsTo = 2;"
dbs.Close
End Sub