473,405 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

A97: When to set var to Nothing?

MLH
Dim MyDB As Database, rstITSLttrs As Recordset, rstOtherTable As
Recordset
Set MyDB = CurrentDb()
Set rstITSLttrs = MyDB.OpenRecordset("qryITSLetterList",
dbOpenDynaset)
rstITSLttrs.MoveFirst
Do Until rstITSLttrs.EOF
....

In the above snippet, which of the dim'd vars should be set to Nothing
at the end of their usefulness? For example, I'm unsure if setting
MyDB to Nothing at the end really accomplishes anything at all.
May 10 '06 #1
2 1349
MLH wrote:
Dim MyDB As Database, rstITSLttrs As Recordset, rstOtherTable As
Recordset
Set MyDB = CurrentDb()
Set rstITSLttrs = MyDB.OpenRecordset("qryITSLetterList",
dbOpenDynaset)
rstITSLttrs.MoveFirst
Do Until rstITSLttrs.EOF
...

In the above snippet, which of the dim'd vars should be set to Nothing
at the end of their usefulness? For example, I'm unsure if setting
MyDB to Nothing at the end really accomplishes anything at all.


You shouldn't "have" to set any of them to nothing. Because that doesn't
always work as advertised the usual advice is to set them all to nothing in
the reverse order that they are dimmed.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
May 10 '06 #2
"Rick Brandt" <ri*********@hotmail.com> wrote in
news:fq*******************@newssvr14.news.prodigy. com:
MLH wrote:
Dim MyDB As Database, rstITSLttrs As Recordset, rstOtherTable As
Recordset
Set MyDB = CurrentDb()
Set rstITSLttrs = MyDB.OpenRecordset("qryITSLetterList",
dbOpenDynaset)
rstITSLttrs.MoveFirst
Do Until rstITSLttrs.EOF
...

In the above snippet, which of the dim'd vars should be set to
Nothing at the end of their usefulness? For example, I'm unsure
if setting MyDB to Nothing at the end really accomplishes
anything at all.


You shouldn't "have" to set any of them to nothing. Because that
doesn't always work as advertised the usual advice is to set them
all to nothing in the reverse order that they are dimmed.


And all recordset variables should be closed before setting them to
Nothing, as well as any database variable that is pointing to
anything other than the MDB currently open in the Access UI.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
May 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David B | last post by:
The code posted below creates an email in outlook. It works fine in A97. However when one of my users moved up to 2000 then an error message - 91 object variable or with block variable not set ...
0
by: Douglas Buchanan | last post by:
I cannot create a database. (A97) Not with *any* name I try! I get the following error: ====================== Microsoft Access ---------------------- The Database 'C:\Documents and...
22
by: Bradley | last post by:
Has anyone else noticed this problem? I converted the back-end to A2000 and the performance problem was fixed. We supply a 97 and 2000 version of our software so we kept the backend in A97 to make...
9
by: Rick Brandt | last post by:
We are seeing performance problems running an A97 app on a new Terminal Server (Windows Server 2003) with Citrix MetaFrame XP. Our admin indicates that he has seen messages in other groups that...
10
by: MLH | last post by:
MyLocPhone: Format$(,"(@@@) @@@-@@@@") The above expression is a field in a select query. On one XP box (the dev box, of course). It works fine. On two other XP boxen - it fails saying "Function...
10
by: MLH | last post by:
My A97 runtime installations are sometimes paused during the install process prompting user with messages saying the files are in use. Generally, I tell them to click IGNORE. Although I haven't...
10
by: Arno R | last post by:
Hi all, I have a database that I need to use in different versions of Access. This is A97 in most places and A2k in a few other locations. (I develop in A97 and convert the db to A2k for these...
24
by: MLH | last post by:
I have noticed, in the following code snippet, that if tblCorrespondence has no records in it, I get an error 91 later during processing. It complains that an object variable or a With block...
2
by: MLH | last post by:
HowManyMore = InputBox(MyString, "How Many More?", "3") The above line results in an InputBox displaying that has an X button in the upper right corner. And next to it, there's a ? button (for...
11
by: The Frog | last post by:
Hi all, Maybe I am just missing something simple here, but I seem to have an issue with a callback function in A97 that is used to fill a Listbox with values. The first time the callback...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.