This topic is locked

Update field in Master table when detail is added

6/13/2008 3:14:13 PM
ASPRunnerPro General questions
M
mnegrete author

My Access database has an EquipmentMaster table containing field 'CurrLocHistID'. The Detail Table (LocationHistory) contains the locations that the equipment has been located, with a DropoffDate field. I need to be able to update the 'CurrLocHistID' field in the EquipmentMaster table when a record is added to the LocationHistory table that is the most current based on the DropoffDate field (tables link by SerialNumber). I was attempting to use 'Events', 'After Record Added' but really have no idea how to write the necessary code.
Any help would be appreciated!!

J
Jane 6/18/2008

Hi,
here is a sample:

strSQLUpdate = "update EquipmentMaster set CurrLocHistID='" & dict("DropoffDate") & "' where SerialNumber=" Session(strTableName & "_masterkey1")

dbConnection.Execute strSQLUpdate