469,270 Members | 1,164 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

do i need to set objects to nothing

Hi Folk

I have about 1000 procedures in my project. Many, many of them are along
the lines of

function myfuntion () as boolean
on error goto er
'-
Dim Dbs as dao.database
Dim Rst as dao.recordset
Dim SqlS as string
'-
sqls = "..."
set dbs = currentdb
set rst = dbs.openrecordset(sqls)
do while not rst.eof
.....
rst.movenext
loop
'-
xt:
exit function
er:
msgbox error$
resume xt
end function
Should set dbs and rst to nothing or is that not necessary. If so, does
anyone know of an easy way to update all my procedures at once?

TIA

- Nicolaas
Nov 13 '05
106 5597
Trevor Best <no****@besty.org.uk> wrote in
news:42**********************@news.zen.co.uk:
David W. Fenton wrote:
You might have run into the "feature" where you have more than
one recordset variable set to .RecordsetClone, move one and it
moves the other.


Er, wouldn't that be the case in A97, too?


I haven't used that for about 6 years. :-)


Well, that was the subject of discussion, i.e., things that work in
A97 and can break when converted to A2K.
And, given the concept of what .RecordsetClone is supposed to be
*for*, isn't that the way you'd *want* it to work?


<fx: long sigh> That's why I mentioned it. It's more likely that
it's
that what happened to Steve than what he said (moving
recordsetclone moved the form as well, see below, that requires a
bit more effort)


I still don't get what the complaint is. It does what it's supposed
to do. It did it that way in A97, it appears to me to do the same
things in A2K.

Steve's problems appear to have come from incorrectly assuming that
using the new .Recordset object would work the same way as
..RecordsetClone. I don't see that this assumption was warranted at
all, but I can see that it's a logical possibility.

And, of course, it seems to me that it's yet another example of
where the introduction of the useless ADO has compromised basic
Access functionality.

As MichKa explains in his article, the change to ADO navigation in
the bookmark navigation wizard is caused by the desire to make the
code work in both MDBs and ADPs. That seems like a colossally stupid
goal to me, but, hey, what do I know?
I've never understood the use of recordset variables with
.RecordsetClone. What, exactly, are you accomplishing by doing
that, except complicating things?


Find feature on a form, e.g.

set rst = me.recordsetclone
rst.findfirst strCriteria
if rst.nomatch then
msgbox "not found"
else
me.bookmark = rst.bookmark
end if


With Me.RecordsetClone
.FindFirst strCriteria
If .nomatch then
msgbox "not found"
Else
Me.Bookmark = .Bookmark
End If
End With

Um, tell me again why you need to use a recordset variable?

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #101
David W. Fenton wrote:
I still don't get what the complaint is. It does what it's supposed
to do. It did it that way in A97, it appears to me to do the same
things in A2K.
I wasn't complaining in the first place, I was pointing out a feature
that may catch someone out.

Um, tell me again why you need to use a recordset variable?


Force of habit.

--
[OO=00=OO]
Nov 13 '05 #102
Trevor Best <no****@besty.org.uk> wrote in
news:42***********************@news.zen.co.uk:
David W. Fenton wrote:
I still don't get what the complaint is. It does what it's
supposed to do. It did it that way in A97, it appears to me to do
the same things in A2K.


I wasn't complaining in the first place, I was pointing out a
feature that may catch someone out.


But only if they don't understand how the object they are using is
supposed to work.
Um, tell me again why you need to use a recordset variable?


Force of habit.


The rule of thumb for me is that an object that you didn't create
doesn't necessarily need its own variable.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #103
David W. Fenton wrote:
I wasn't complaining in the first place, I was pointing out a
feature that may catch someone out.

But only if they don't understand how the object they are using is
supposed to work.


And everyone does?
The rule of thumb for me is that an object that you didn't create
doesn't necessarily need its own variable.


Although if you're already in a with block you can confuse things with
nested withs.

--
[OO=00=OO]
Nov 13 '05 #104
Trevor Best <no****@besty.org.uk> wrote in
news:42***********************@news.zen.co.uk:
David W. Fenton wrote:
I wasn't complaining in the first place, I was pointing out a
feature that may catch someone out.


But only if they don't understand how the object they are using
is supposed to work.


And everyone does?


Well, that's pilot error, for whatever reason.

The point is, I don't see any evidence at all of Steve's original
assertion, that .RecordsetClone code that worked in A97 breaks in
A2K. The only case of that is stupidly trivial, if you write the
same code in an ADP. Since you can't convert an A97 MDB to an A2K
ADP, it really has nothing whatsoever to do with the topic of
discussion.
The rule of thumb for me is that an object that you didn't create
doesn't necessarily need its own variable.


Although if you're already in a with block you can confuse things
with nested withs.


Well, sure, but how often will you do that with the form's
RecordsetClone?

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #105
David W. Fenton wrote:
But only if they don't understand how the object they are using
is supposed to work.


And everyone does?

Well, that's pilot error, for whatever reason.


That's the point. Otherwise there's no point in this group if everyone
who use it was an expert.

--
[OO=00=OO]
Nov 13 '05 #106
Trevor Best <no****@besty.org.uk> wrote in
news:42***********************@news.zen.co.uk:
David W. Fenton wrote:
But only if they don't understand how the object they are using
is supposed to work.

And everyone does?


Well, that's pilot error, for whatever reason.


That's the point. Otherwise there's no point in this group if
everyone who use it was an expert.


Well, in the context of a thread about supposed *bugs* in
..RecordsetClone in A2K compared to A97, you can, I think, see why
I'd react to advice about pilot error as not too relevant.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #107

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Bobby | last post: by
2 posts views Thread by Lin Ma | last post: by
16 posts views Thread by Joel Finkel | last post: by
9 posts views Thread by pic078 via AccessMonster.com | last post: by
1 post views Thread by =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.