Should (Access) recordset.findfirst have performance issues with dates?

允我心安 提交于 2019-12-24 08:50:16

问题


I'm using Access to iterate through a table, finding relevant information and bringing it together in a master table.

It loads up both recordsets, starts iterating through rsImport (Local <1000 row table), for each rsImport row, it looks to see if is a row that matches the UniqueRef in rsRecords, which it will then eithe update or add if it doens't exist.

F8 stepping through the complete code it actually pauses when it des the rsRecords.findfirst. If I remove the DateofAction part, it speeds up, so it's something to do with dates.

Any ideas?

I use:

Dim rsImport As DAO.Recordset, rsRecords As DAO.Recordset
Set rsImport = CurrentDb().OpenRecordset("SELECT * from tblFeedbackImport", dbOpenDynaset)
rsImport.MoveLast
rsImport.MoveFirst
Set rsRecords = CurrentDb().OpenRecordset("SELECT * from dbo_tblFeedbackRecords", dbOpenDynaset, dbSeeChanges)
rsRecords.MoveLast
rsRecords.MoveFirst

Do While rsImport.EOF = False
 rsRecords.FindFirst "UniqueRef='" & Trim(rsImport!UniqueRef) & "' AND DateofAction=#" & Format(rsImport!DateofAction, "m-d-yy") & "#"

 rsImport.MoveNext
Loop

I've a PrimaryIndex (Clustered) based on the two columns (UNiqueRef and DateOfAction).

来源:https://stackoverflow.com/questions/11397943/should-access-recordset-findfirst-have-performance-issues-with-dates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!