Subform loses recordset - shows #Name?



A little background: We have an Access 2002 based user interface to our
SQL Server 2000 database. The interface is a tabbed form with two of
the tabs containing a subform. Data is pulled from the SQL Server
using several stored procedures, one sproc for the main form and an
additional sproc for each subform. All data is pulled from the SQL
Server using ADO; the resulting client side (disconnected)
ADODB.Recordset is then applied to each of the forms/subforms Recordset
property.

Set Me.Recordset = Nothing

' build recordset
Dim rstUsers As ADODB.Recordset: Set rstUsers = New ADODB.Recordset
rstUsers.CursorLocation = adUseClient
rstUsers.CursorType = adOpenForwardOnly
rstUsers.LockType = adLockBatchOptimistic

' get sp results
rstUsers.Open "EXEC usp_SubForm1 @PKstrNum='" & strFindNum & "'", _
ClassCNN.cnn, _
ADODB.adOpenForwardOnly, _
ADODB.adLockBatchOptimistic

' Disconnect the recordset
rstUsers.ActiveConnection = Nothing

' Assign user rs to forms rs
Set Me.Recordset = rstUsers

Pulling the data from the server and displaying it in our Access db
front end works just fine, except one of the subforms in particular
will lose its recordset data at unspecified times. Me.Recordset
becomes Nothing when viewed in the watch window. This usually happens
when the user leaves the Access db open and starts using other
applications on the computer. When they come back after 5 minutes or
often times more, the subform loses its data and shows #Name? in all of
the text fields on the subform. The other forms seem unaffected by
this behavior.

This is very frustrating to track down as none of the users seem to
know how this happens. I've been trying to reproduce the issue for
the past 6 hours and have only had it happen to me twice.

I've looked the VBA code over and was unable to find any place in the
code that the subforms recordset property was getting set to nothing.
I also tried keeping a global reference to the ADO recordset rstUsers
for debugging purposes, and while me.Recordset was nothing, rstUsers
had all the data still.

Where is me.Recordset going?

.



Relevant Pages

  • Re: Assigning value to subform fields
    ... You'll have to give us some idea of what ADOPRDBRW looks like. ... > I have a form and subform created in msaccess database which used to refer ... I am trying to connect them to sql server ie, ... > recordset and assigning text field value to recordset value for the field. ...
    (microsoft.public.access.formscoding)
  • Re: Assigning value to subform fields
    ... I have a form and subform created in msaccess database which used to refer ... I am trying to connect them to sql server ie, ... recordset and assigning text field value to recordset value for the field. ...
    (microsoft.public.access.formscoding)
  • Re: Cross Database Join, C++ program set up confusion
    ... Well what kind of data are you returning if it is not in Recordset? ... Recordset is returned (it is fractionally faster as ADO does not waste time ... If the default database is db1 on the ... It is a function of SQL Server. ...
    (microsoft.public.vc.database)
  • Re: Full-Text Results to MS Access
    ... Being new to SQL Server and ADO, ... (My database was started in pre-ADO days so the Access ... like a true/false flag, a value, etc., but if the result is a recordset, I ... based on some full-text search criteria. ...
    (microsoft.public.sqlserver.fulltext)
  • RE: Error 3197
    ... SQL Server 2005 as the backend. ... The trigger is designed to do a rollback and not commit any changes to the ... Tab1 subform is unbound and has no issues. ... 'Requery subform "Details" to hide records marked IsRemove = true ...
    (microsoft.public.access.tablesdbdesign)