I have an Access application which has a table (AuditTrail) linked to SQL Server 2008. I am trying to add records to the audit trail table programmatically.
I have the following code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("AuditTrail", dbOpenDynaset, dbSeeChanges)
With rs
.AddNew
rs("dtDateTime") = Now()
rs("txtComment") = Nz(Mycomment, "")
.Update
.Close
End With
Set db = Nothing
Set rs = Nothing
The problem that I have noticed recently is that it takes several seconds (up to 13 seconds) to run the .AddNew statement.
The table has about half a million records by now.
Is there any way I can lower the this time?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…