I have a Microsoft Access 2003 ADP that uses a linked “main” form with several related continuous style forms. They all use disabled Recordsets through a helper class.
Several users noticed the same strange behavior: they add / edit a record in a continuous subordinate form, leave a record (fix editing in the recordset), lock the computer (Ctrl + Alt + Del), they unlock the computer, they return to the form, approximately after 5 seconds, it flickers and returns to its original state without a name.
I was able to reproduce this by following the steps above, then after making changes to my form related to the disabled recordset, I switched to SQL Server and changed the value. After the computer lock / unlock procedure, the form flickers and updates, and a new value appears that I just entered in SQL Server.
As if after about 5 seconds my disconnected recordset is reconnected (at its discretion) and requests a recordset.
I understand that I do not give much information here, but did anyone encounter a problem with disabled Recordsets that reconnected and demanded? Or at least have ideas on where I can start debugging?
I have an ADP and SQL script to create a database if someone would like to recreate this in their environment.
This is how I create a disabled recordset:
Dim cnn As ADODB.Connection
Dim stmTest As ADODB.Stream
Set cnn = New ADODB.Connection
cnn.Open Application.CurrentProject.AccessConnection.ConnectionString
' Create recordset and disconnect it.
Set mrsTest = New ADODB.Recordset
mrsTest.CursorLocation = adUseClient
mrsTest.Open "SELECT * FROM [tblChild] WHERE ParentID = 1" _
, cnn _
, adOpenStatic, adLockBatchOptimistic
Set mrsTest.ActiveConnection = Nothing
cnn.Close
Set cnn = Nothing
' Copy recordset to stream in memory.
Set stmTest = New ADODB.Stream
stmTest.Open
mrsTest.Save stmTest, adPersistADTG
' Bind form to disconnected recordset.
Set Me.Recordset = mrsTest
' Open a copy of the recordset from the stream.
Set mrsTest = New ADODB.Recordset
stmTest.Position = 0
mrsTest.Open stmTest