Advice: closing objects after query in Access DB

From: rotor (anonymous_at_discussions.microsoft.com)
Date: 05/13/04


Date: Thu, 13 May 2004 07:01:08 -0700

Hello, I'm using VBA, ADO in Access 2002.

I have a function that I can call on the fly that takes a SQL argument and then executes an ADO query. This function then returns an ADO recordset to the calling subroutine.

I really like this functionality and it works great, BUT I can't close the connection in the usual manner inside the function because the function actually returns the recordset.

1. Does this hurt anything since the connection is never closed, or does it matter? Does the connection persist after the RS is passed on to another subroutine?

2. If this is not a good thing, how can I close the connection and keep the recordset?

3. Because the recordset is passed on, that is not closed in the source function either. Does this matter?

 I really do not want to restructure my functions, work arounds? Please advise on this. Thanks much in advance.



Relevant Pages

  • Re: Advice: closing objects after query in Access DB
    ... Loosing opened connection is not a good idea. ... What you need to do is to open recordset on a client side, ... > Hello, I'm using VBA, ADO in Access 2002. ... Does this matter? ...
    (microsoft.public.data.ado)
  • Re: Updating Access data using SQL / refresh time question
    ... As a test today, for one poarticular recordset, I changed from DAO to ADO to ... > I forgot to mention that the expense of repeated connection open and close ... > dim oconn as new adodb.connection ... > 'Now load the listview by looping through each RS row ...
    (microsoft.public.vb.database)
  • Re: Updating Access data using SQL / refresh time question
    ... > I forgot to mention that the expense of repeated connection open and close ... > dim oconn as new adodb.connection ... > 'Now load the listview by looping through each RS row ... > ' Set the recordset object each time we load the listview ...
    (microsoft.public.vb.database)
  • Re: Problem: MDB-Datenbank Zugriff über das Intranet
    ... Wie und wo öffnest Du Deine Connection zur *.mdb? ... > End With ... Du öffnest ein Recordset mit adOpenForwardOnly. ... Datensatz liegenden Datensatz zuzugreifen. ...
    (microsoft.public.de.vb.datenbank)
  • Re: ASP - FROM statement slows down connection to database
    ... Open your database in Access, switch to the Queries tab, create a new query ... in Design View without choosing a table, swtich to SQL View, paste the sql ... connection string rather than using an ... recordset open statements. ...
    (microsoft.public.inetserver.asp.db)