Selasa, 24 Februari 2015

RE: [MS_AccessPros] Proper way to exit procedure if RS is empty

 

Hi John/Liz

 

I think Michael Kaplan wrote an article some years ago in which he reported demonstrating that closing a Database object set to CurrentDb() resulted in a no-op.  However, closing such an object is clearly unnecessary and therefore should be avoided.

 

What is VERY necessary is closing any recordset that was opened on a locally declared Recordset object, before the procedure exits.  I'm not sure if it is still the case, but exiting a procedure without closing local recordsets used to cause Access "ghosts" – processes which disappear from the screen when Access is closed, but remain running with files open, only visible in the Task Manager.

 

Cheers,
Graham

 

 

 

From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Wednesday, 25 February 2015 07:20
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Proper way to exit procedure if RS is empty

 

 

Elizabeth-

 

Setting the db object to Nothing clears it so you don't get any memory leaks (a problem in earlier versions).  But you should NEVER close a db object set to the current database.  (Used to cause Access to blow up circa 2000 and earlier.)

 

John Viescas, Author

Microsoft Access 2010 Inside Out

Microsoft Access 2007 Inside Out

Microsoft Access 2003 Inside Out

Building Microsoft Access Applications 

SQL Queries for Mere Mortals 

(Paris, France)

 

 

 

On Feb 24, 2015, at 6:51 PM, glcass58@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

 

Hi John,

Thanks for your response.  I'm a little confused though.  In your example, isn't your db object set to the current db?  So you don't need to set that to nothing?  Just want to make sure I understand. :)

Thanks,

Elizabeth

 

__._,_.___

Posted by: "Graham Mandeno" <graham@mandeno.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (5)

.

__,_._,___

Tidak ada komentar:

Posting Komentar