I am using an Access database that I upsized the tables into SQL Server 2005. I have a function to write to an Audit table that works fine with Access tables, but does not work with the SQL tables. The code I used is below. I added the db SeeChanges option to the Open Recordset method as I was prompted to do so by the system. This eliminated the error message I was getting, but the records do not write to the table.
Sub WriteAuditUpdateToTemp(txtTableName, lngRecordNum, txtFieldName, OrgValue, CurValue)
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset(“Select * from rAuditTemp”, , dbSeeChanges)
rs.AddNew
rs!TableName = txtTableName
rs!RecordPrimaryKey = lngRecordNum
rs!FieldName = txtFieldName
rs!LoginName = GetCurrentUserName
rs!MachineName = GetComputerName
rs!User = CurrentUser ‘returns Access Security name
rs!OriginalValue = OrgValue
rs!NewValue = CurValue
rs!DateTimeStamp = Now()
rs.Update
rs.Close
db.Close
End Sub
Any ideas on why this will not work with SQL tables?
Carla