G
Guest
I'm using ADO from XL2000 to work with an Access Database. I've been
requested to create a "back-out' procedure, and I want to make sure I'm
thinking along the right lines. Feel free to analyze and respond to the
following:
Create a universal "Back-Out" table to store the changed data. Ex: Changed
was EmpName from "Clay" to "Ralph". EmpNum (key) is 256. The Back-Out record
would look like this:
Back-Out.[TableName] = 'EmpData'
Back-Out.[KeyField] = 'EmpNum'
Back-Out.[Key] = '256'
Back-Out.[FieldName] = 'EmpName'
Back-Out.[OldData] = 'Clay'
Back-Out.[NewData] = 'Ralph'
And the VBA SQL string would look like this:
SQLString = "UPDATE " & tablename & " SET [" & fieldname & "] = '" & olddata
& "' WHERE [" & keyfield & "] = '" & key & "';"
Resulting in this:
SQLString = "UPDATE EmpData SET [EmpName] = 'Clay' WHERE [EmpNum] = '256';
requested to create a "back-out' procedure, and I want to make sure I'm
thinking along the right lines. Feel free to analyze and respond to the
following:
Create a universal "Back-Out" table to store the changed data. Ex: Changed
was EmpName from "Clay" to "Ralph". EmpNum (key) is 256. The Back-Out record
would look like this:
Back-Out.[TableName] = 'EmpData'
Back-Out.[KeyField] = 'EmpNum'
Back-Out.[Key] = '256'
Back-Out.[FieldName] = 'EmpName'
Back-Out.[OldData] = 'Clay'
Back-Out.[NewData] = 'Ralph'
And the VBA SQL string would look like this:
SQLString = "UPDATE " & tablename & " SET [" & fieldname & "] = '" & olddata
& "' WHERE [" & keyfield & "] = '" & key & "';"
Resulting in this:
SQLString = "UPDATE EmpData SET [EmpName] = 'Clay' WHERE [EmpNum] = '256';