ACC1x: Updating a Separate Table When a Value Changes on a FormID: Q95445
|
This article shows by example how to have Microsoft Access automatically
update a field in a table when you use a form to change a related field
in a different table. In other words, you can have Microsoft Access post
your changes to a separate table that is not bound to the form.
To set this up, you need to:
This example uses the Products form in the sample database NWIND.MDB. Here
is the step-by-step procedure:
Table: Products
--------------------------
Field Name: Product ID
DataType: Number
FieldSize: Long Integer
Form: Products
---------------------------------
OnCurrent: UpdateOther.SaveValue
AfterUpdate: UpdateOther.ChgValue
Field: Product ID
-----------------
Locked: No
Control: Text box
------------------------
ControlName: Previous ID
Visible: No
Macro Name Action and Action Arguments
----------------------------------------
SaveValue SetValue
Item: [Previous ID]
Expression: [Product ID]
ChgValue SetWarnings
Warnings On: No
OpenQuery
Query Name: IDChgQuery
View: Datasheet
Data Mode: Edit
SetValue
Item: [Previous ID]
Expression: [Product ID]
macrogroupname.macroname
Query: IDChgQuery
--------------------------------------------
Tables: Orders Detail
Field: Product ID
Update To: Forms![Products]![Product ID]
Criteria: Forms![Products]![Previous ID]
Keywords : kbusage FmsEvnt
Version : 1.0 1.1
Platform : WINDOWS
Issue type : kbinfo
Last Reviewed: March 19, 1999