R
razebo
Guest
I am modifying one the default Access template databases (InventoryControl)...
I created another number field in the Inventory Transactions table (UnitsRemoved) and duplicated this table to create an append query. I have also set up a macro that triggers the append query on the UnitsRemoved field 'after update'. The append query works except I get all records from Inventory Transactions...I only want the current record - after it has been changed.
I think my problem is with setting criteria..the duplicate table with same fields(Total Units Removed)is basically going to be recording change history and could be any numeric value so there will be duplicate transaction IDs, but this should not matter since the key in Table2 is an autonumber field. How do I set the criteria for this to get only the changed record? (I am not a VB person!)
INSERT INTO [Total Units Removed] ( TransactionDate, ProductID, TransactionDescription, UnitsRemoved, DateRemoved, Location, PurchaseOrderID )
SELECT [Inventory Transactions].TransactionDate, [Inventory Transactions].ProductID, [Inventory Transactions].TransactionDescription, [Inventory Transactions].UnitsRemoved, [Inventory Transactions].DateRemoved, [Inventory Transactions].Location, [Inventory Transactions].PurchaseOrderID
FROM [Inventory Transactions]
WHERE [Total Units Removed].UnitsRemoved = [Forms]![Products]![ProductsSubform]![UnitsRemoved];
I created another number field in the Inventory Transactions table (UnitsRemoved) and duplicated this table to create an append query. I have also set up a macro that triggers the append query on the UnitsRemoved field 'after update'. The append query works except I get all records from Inventory Transactions...I only want the current record - after it has been changed.
I think my problem is with setting criteria..the duplicate table with same fields(Total Units Removed)is basically going to be recording change history and could be any numeric value so there will be duplicate transaction IDs, but this should not matter since the key in Table2 is an autonumber field. How do I set the criteria for this to get only the changed record? (I am not a VB person!)
INSERT INTO [Total Units Removed] ( TransactionDate, ProductID, TransactionDescription, UnitsRemoved, DateRemoved, Location, PurchaseOrderID )
SELECT [Inventory Transactions].TransactionDate, [Inventory Transactions].ProductID, [Inventory Transactions].TransactionDescription, [Inventory Transactions].UnitsRemoved, [Inventory Transactions].DateRemoved, [Inventory Transactions].Location, [Inventory Transactions].PurchaseOrderID
FROM [Inventory Transactions]
WHERE [Total Units Removed].UnitsRemoved = [Forms]![Products]![ProductsSubform]![UnitsRemoved];