Updating ms access
As you just saw in the previous section, we have a data macro defined in the After Insert event to mark the employee's Active field to False whenever we create a termination record.
What happens, though, if we accidentally select the wrong employee when we save the new termination record?
Set Field Name: [qry DMTerm Query].[Active] Value: True End Edit Record End If Comment Block: After modifying this termination record, make sure the employee that it's assigned to now is marked as an inactive employee.
To do that, we look up the matching employee's record in the tbl Employees table and set the Active field to False.
A Microsoft Access Update Query updates specified values in a table for all records or for those records that match a specified criteria.
If the Employee ID field changed, we know the user is assigning this existing termination record to a different employee.You will save yourself time, and eliminate the possibility of manual errors.Note: Due to the permanent effects of working with an update action query, you should always make a backup copy of your tables, or your database before attempting this option.Comment Block: For the Where condition in this Lookup Record, use the Old value from the Employee ID field and find that employee's record.Lookup Record In qry DMTerm Query Where Condition = [Employee ID]=[Old].[Employee ID] Alias Edit Record Alias Comment Block: Now set Active field to True for this employee since it was probably initially assigned to the employee in error.