As a class project, I'm creating an Access 2010 database that tracks inventory. For the purpose of this question, there are two relevant tables, Assets and Actions, and one relevant form, Update Asset. My goal is to have a new record inserted into the Actions table every time someone updates a record in the Assets table. The new Actions record would contain a snapshot of the fields contained in the current record at the time of the save.
The Update Asset form has a macro called AuditLog attached to the After Update event. The macro uses the RunSQL command with the following parameters:
SQL Statement:
INSERT INTO Actions (AssetTag, LocationID,Slot,Status,Timestamp,TechID) ;
SELECT(AssetTag,LocationID,Slot,Status,LastUpdated,TechID) FROM Assets WHERE
Assets!AssetTag = Me!AssetTag ;
Use Transaction: Yes
However, when I go to save record, I get the following error:
Syntax Error in INSERT INTO statement
Macro Name: AuditLog
Action Name: RunSQL
Arguments: INSERT INTO Actions (AssetTag, LocationID,Slot,Status,Timestamp,TechID) ; SELECT (AssetTag,LocationID,Slot,Status,LastUpdated,TechID) FROM Assets WHERE Assets!AssetTag = Me!AssetTag ;, Yes
Error Number: 2950
I have added the folder with the database to Access' list of trusted locations. Access is definitely not my strong point, so any help would be greatly appreciated.