Some code working for years suddenly started to produce unexpected (and false) results. The code runs in a form and is similar to this:
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "docId = " & strContainsDocIdNumber
Me.Bookmark = rs.Bookmark
This code normally brings the user to the correct record. and recently it started behaving erratically, going to totally unrelated records. e.g. instead of going to DocId 66345, it goes to DocId 1042 (always small numbers).
I did try to debug step by step, inspecting the values, no clue.
I also reindexed all tables in SQL Server 2008R2 database, and refreshed the table link, without any improvement.
Any hint or suggestion ?
edit: I solved the problem by using DoCmd.FindRecord, and I am quite sure my code is NOT in cause, since it worked for several years without a problem. I am looking for clues regarding Access – SQL Server interaction bugs like this one.
I have encountered bugs in ms-access such as these in typical scenario
I usually try the following
compact and repair
decompile (read about it, this looked ok, http://www.fmsinc.com/microsoftaccess/errors/Bad_DLL_Calling_Convention.asp)
copy the object which contains the troublesome code into a new copy and delete the old one, rename the new one to old name. check if bug has gone away
import all the objects into a freshly created new access database