Closing Database Objects: Explicitly Required?

Agreed, this is from the OP.
I included it with >> << to try to avoid attributing the first part to Chris but without it his response which is what I was trying to quote would have no context.
This was certainly not an attempt by me to misquote Chris.
Sorry if this was not sufficiently clear.
 
DrallocD

In a strange way your replies in this thread are useful.
You clearly demonstrate how far some people will go to try and defend the indefensible.

When corrected you apologise but then continue to make the same mistake.

You can not stick to the facts.
You have no idea how to keep things simple.
You try to change the subject to suit your own purpose.
You misquote Microsoft.
You misquote people.
You modify what someone has said and then misquote them.
You modify a post and leave no reason.
You write VB code in a VBA thread.
You tell someone to grow up and that they lie, in public.
You then apologise for that in private, via PM.

What thinking people now have to decide is if your mistakes are deliberate or not.

If you want to continue to reply in this thread, go back to post #1 and stick to the question. Stay within the context of that question and be prepared to prove what you say with a VBA demonstration upload. I, for one, will not put up with easily retracted diatribe. I will ask for coded proof and I will attempt to pick the eyes out of it.

Remove your company name from any uploads you might make. Who you are and who you work for means absolutely nothing to me. You are traceable and even though you may not care about bringing your own name into disrepute, your company might. Make the cautious assumption that what you say on any part of the web will propagate to the entire web.

Please take the above as a warning.

As it stands at the moment; you are not part of the solution; you are part of the ongoing problem.


Chris.
 
Quoting myself.

Dralloc

Quote:
I am not sure why you say that he didn't say this
Why do you insist on misquoting. I did not say that he did not say never. That is what you said. I simply asked for you to point out where you claim he did.

I am not going to say that Chris said something when he didn't. I will leave that sort of thing up to you as you are very good at it.

Dralloc

I have still not heard you reason for misquoting me. (Post 57)

Are you simply going to deny what you said by ignoring this question.?
 
Last edited:
Hi RainLover,

I think you mean post 56.

I answered this in line 1 of Post 57 and clarified it in post 61.
 
Dralloc

Post 57 is where you made the statement and post 61 has nothing to do with me.

Are you being serious or are you toying with me.
 
Sorry, I think I may know where the confusion is.

When I said "I am not sure why you say that he didn't say this" I was referring to your comment in the previous post (56) in which you said "That is not Chris's quote."

Post 61 was for you and was explaining that it was his quote.
 
ChrisO,

If you still feel like this then I am okay to end this thread.

All of these were before post 39 when I explained, appologised and thought we were okay to move on with a more positive thread.

I did not appologize for "Grow Up". I am sorry. You were right, 24 hours was more than long enough to look at the sample code in post 5 and realise that it was down to inexperienced programming, not rs.Close. If any line of code in the exit handler can cause an error you must either prevent it by checking, in this case that rs is not null or closed before closing it, or use "on error resume next" as the first line of the exit handler. Failure to do this will cause an endless loop between the exit handler and error handler.
 
Quoting myself.

Dralloc

I am not sure why you say that he didn't say this
Why do you insist on misquoting. I did not say that he did not say never. That is what you said. I simply asked for you to point out where you claim he did.

I am not going to say that Chris said something when he didn't. I will leave that sort of thing up to you as you are very good at it.
Dralloc

I have still not heard you reason for misquoting me. (Post 57)

Are you simply going to deny what you said by ignoring this question.?

I placed in bold the issue that you are attempting to avoid.

But let me make things easy for you.

Just simply forget it. It is not possible to have a sensible discussion with a person who does not know who said what even though it is right there in front of them.

I get the feeling that someone is behind you pushing your buttons in order to confuse the original question.

To close on some friendly advise, and this goes for everyone. Do not post your business details if you don't wish to bear your all to the general public.

In your case I have been able to obtain your Resume.

EDIT

Resume for some unknown reason was in Blue. It was never a link.
 
Last edited:
Hi Rain,
In your case I have been able to obtain your Resume.
I should like to read this but I am unable to. Would you know why? or how I could get to read it?
 
Bob

I don't think that that would be the right thing to do.

Trust you understand.
 
Bob

I don't think that that would be the right thing to do.

Trust you understand.
I think I understand, but even if I don't, I think there's enough arguing here without me throwing in another bone to pick over.:D Thanks for your swift reply.
 
Bob

This argument about closing not closing has been going on for years.

It appears that no one can prove either way. I post a sample at UA some two and a half years ago. Still no one can prove it wrong.

ChrisO and I once run two or three machines overnight attempting to cause a crash or memory leakage. Nothing happened.

To me problems do occur by not closing but this is because of bad programing in the first place. So when they Explicitly Close they are overcoming the affects that they created in the first place. But this is just my educated opinion.

What both Chris and I is for someone to show proof either way. I believe that the test I posted before and a slightly different one I posted in this thread is proof that Not Closing has no effect.

Once the sub is closed everything within also closes.

If you have something to say either way please jump in. Your comments would be most welcomed.

What is frowned on is where one person quotes another who quotes another till you end up back where you started.

We need fresh information in the form of a Database that proves either way.
 
Rain,
If you have something to say either way please jump in. Your comments would be most welcomed.
Thanks for the invitation, but I don't feel I have anything of value to offer to you. I am, of course, following with interest.
 
RainLover,

Thanks for the friendly advice, this will be my last post on this thread.
 
Whilst reading through this post it reminded me of something Richard Feynman said:-

Extract:-
From HERE:- http://www.openculture.com/2016/04/...-telling-science-from-pseudoscience-1966.html
Feynman’s insistence on ordinary language recalls the statement attributed to Einstein about not really understanding something unless you can explain it to your grandmother. The method, Feynman says, guards against learning “a mystic formula for answering questions,” and Oxenham describes it as “a valuable way of testing ourselves on whether we have really learned something, or whether we just think we have learned something.”

Some of the parts of this thread read a little like that, there is an understanding of something at a superficial level without any real questioning of it on a deeper level a real understanding of what's going on.

I have for a long time questioned the logic in the statement that you mustn't use "Global Variables". Mainly because I've noticed lots of people still use them, so that sort of doesn't make sense. If the are needed, then why say don't use them? If you dig into it (I haven't investigated it thoroughly so I would be glad of any comment and insight you may have) it appears to me that it's not that you shouldn't use a global variable, it's that there is nearly always something better you can use.

The thing I am currently interested in is the insistence on using Subs and Functions properly. My gut feeling it is just a convention, and there's no real benefit. I would be glad of any insight into whether there are any real benefits in following the convention...

There are some places you have to use a sub or put it another way, you can't use a function. That points me in the direction of a design requirement that made it necessary to add subroutines to the already existing use functions. So I'm guessing that functions existed first and then there became a requirement for something else which was called a subroutine. I'm currently gathering information to do a blog on it, so I will have a better explanation and some examples at a later stage.
 
This post from ChrisO caused him to butt heads with me (in another thread). OK, so sometimes I really AM an old goat, but I wasn't being intentionally or blindly intransigent. In a recent thread three folks found or confirmed cases where failure to clean up properly caused problems for them, specifically for hanging or orphaned processes.

https://access-programmers.co.uk/forums/showthread.php?t=288462&page=3

There are those who will say that this viewpoint of mine is wrong, perhaps, but I say that good programming habits include cleaning up your own messes in a way such that you KNOW it was properly cleaned. Leaving things to chance is like walking across a busy Interstate highway during lunch-hour traffic while blindfolded. Good odds of leaving a nasty mess behind you. (Or being the mess, yecch!)

Proactive cleanup is rarely a bad idea in ANY language I know. In another post in the referenced thread, I listed cases where cleanup WOULD be automatic and when it would not. So I'm not making a blanket statement here. But I simply didn't agree with ChrisO's position.
 
In a recent thread three folks found or confirmed cases where failure to clean up properly caused problems for them, specifically for hanging or orphaned processes.

https://access-programmers.co.uk/forums/showthread.php?t=288462&page=3

Vague hand-waving does not constitute a basis for an argument. Only reproducible evidence counts for anything. (BTW In my experience, the word "properly" is largely used used in a vain attempt to lend credence to an unsubstantiated position.)

There are in fact separate issues here that are being blended together.

One is a complete Furphy. That is the claim that failure to Set an object variable to Nothing will leave an instance of an automated application lingering after it goes out of scope. The example given is usually Excel driven from Access but it applies to all Office Applications.

Fact 1: The automated instance must have the Quit Method applied or it WILL persist after the object variable goes out of scope.

Fact 2. Regardless of whether the object variable is Set to Nothing or not, the instance of the automated application will NOT persist beyond its scope provided that it has been Quit.

Going out of scope means, for variable declared in a procedure, at the end of the procedure. For a variable declared at the top of a Class Module (including an Access Object Module), when the instance of the object is closed. For a variable declared at the top of a Standard Module, when the primary application had been Quit.

These results are consistent and reproducible by anyone who cares to perform the tests.

As I have said before, those who have experienced an automated application persisting and fixed the problem by copiously adding Close, Quit and Set to Nothing everywhere it might fit, have not discriminated the actual cause of the problem. Thus they have no grounds to be making a claim for the case that Set to Nothing is essential. It is the Quit they omitted that is the verifiable cause.

The related matter regards whether or not the absence of Set to Nothing will result in memory leakage, tying up RAM that will never be released, despite the automated application not being listed in Task Manager. This was the issue that ChrisO addressed.

Chris created object variables in millions of loops without including Set to Nothing and did not observe adverse effects. Hence his indignation was at those who insisted (without evidence) that it was a disastrous practice.

Chris was also correct that the claim had become a mantra repeated over and over by developers who had never tested anything, until it took on the status best considered a religious belief.

For the record (and I have said this before), I disagree with Chris about not closing recordsets. Nothing Earth-shatteringly bad happens but I believe the recordset is left lingering until the database engine times out.

Finally I would add that there is one very good reason for Set to Nothing. One day your boss might get someone to audit your code. They will likely be subscribers to the SetToNothing religion and will criticise your work if you omit it. The auditor will have higher status than you because your boss paid more for their advice.

Unfortunately, as in any religion, logical arguments are pointless.
 
Unfortunately, as in any religion, logical arguments are pointless.

Best oxymoron of the day award - managed to use the words "Religious Logical Arguments", in one statement. [ThumbsUp]
 
Finally I would add that there is one very good reason for Set to Nothing. One day your boss might get someone to audit your code. They will likely be subscribers to the SetToNothing religion and will criticise your work if you omit it. The auditor will have higher status than you because your boss paid more for their advice.

And here is where I find myself. This monster I have inherited was developed in 2007 by a UNIX/COBOL programmer who knew little to nothing about Access. Once he transferred out, a few hackers came in and wrote code and developed objects willy-nilly. The first time I "looked under the hood" I was dumbfounded...but that is a topic I could write a book about.

As I turned to this site and the many contributors for guidance, many practices - this one included - were made known to me which I took as gospel because, well it HAD to be, right??!?

I painstakingly went through each module and wrote in error and exit handlers and closed all record sets, databases and reset all variables BEFORE I came across this thread.

I'm not sorry I did...the process was a HUGE education for me while I made mistakes and had to figure out what I did wrong. Without going through it, most of this conversation would have meant nothing to me.

I have saved three fortunes from fortune cookies over my lifetime:

"To ensure hitting your target, it is best to shoot first and claim what is hit as your target" (doesn't apply here but it is damn good advice)

"Good judgment comes from experience. Experience comes from bad judgment"

"Wisdom is the knowledge obtained once it is too late to use it"

The last two pretty much sums up my life with Access and VBA.

And the hits just keep on coming...
 

Users who are viewing this thread

Back
Top Bottom