473,698 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what does Set rst = nothing mean and others

Sorry I just lost tracks of a series of posts, so I post my question again,
hoping someone can help.

Here is codes provided by Jeff Smith
Private Sub Form_Load()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim intI As Integer
Set db = CurrentDb
Set rst = db.OpenRecordse t("qryStudentsS orted")
' Call the routine to clear all fields
' before loading the data.
ClearFields
' Add the StudentName to each text box.
With rst
.MoveFirst
Do Until .EOF Or intI = txtMax
intI = intI + 1
Me("txt" & intI) = !StudentName
.MoveNext
Loop
End With
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub

Can anyone tell me: why need "Call the routine to clear all fields before
loading the data"? and

what do these three lines mean?
rst.Close
Set rst = Nothing
Set db = Nothing


Many thanks in advance.

Paul


Nov 13 '05 #1
2 10394
That first line is just a comment to the people who wrote or look at
the code to help them figure out what they were doing (or what the
code does). Just as it says, the routine (ClearFields) is called
which clears the fields.

rst.close is closing the recordset, which was open with the line
set rst = db.openrecordse t("qryStudentsS orted").

If you open a recordset, you need to close it. Less objects open
saves memory and makes your program run faster. Note: some queries
run (such as delete queries) don't need to be closed after they are
opened.

the last two lines just empty the values in those variables. I know
there is a good reason for doing so, mostly I think because of the
variables/objects and garbage collection and memory leaks.

"Paul T. Rong" <et***@hotmail. com> wrote in message news:<yh******* **********@news .chello.at>...
Sorry I just lost tracks of a series of posts, so I post my question again,
hoping someone can help.

Here is codes provided by Jeff Smith
Private Sub Form_Load()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim intI As Integer
Set db = CurrentDb
Set rst = db.OpenRecordse t("qryStudentsS orted")
' Call the routine to clear all fields
' before loading the data.
ClearFields
' Add the StudentName to each text box.
With rst
.MoveFirst
Do Until .EOF Or intI = txtMax
intI = intI + 1
Me("txt" & intI) = !StudentName
.MoveNext
Loop
End With
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub

Can anyone tell me: why need "Call the routine to clear all fields before
loading the data"? and

what do these three lines mean?
rst.Close
Set rst = Nothing
Set db = Nothing


Many thanks in advance.

Paul

Nov 13 '05 #2
Thank you, that makes sense.

"user_5701" <us*******@hotm ail.com>
??????:f1****** *************** *****@posting.g oogle.com...
That first line is just a comment to the people who wrote or look at
the code to help them figure out what they were doing (or what the
code does). Just as it says, the routine (ClearFields) is called
which clears the fields.

rst.close is closing the recordset, which was open with the line
set rst = db.openrecordse t("qryStudentsS orted").

If you open a recordset, you need to close it. Less objects open
saves memory and makes your program run faster. Note: some queries
run (such as delete queries) don't need to be closed after they are
opened.

the last two lines just empty the values in those variables. I know
there is a good reason for doing so, mostly I think because of the
variables/objects and garbage collection and memory leaks.

"Paul T. Rong" <et***@hotmail. com> wrote in message

news:<yh******* **********@news .chello.at>...
Sorry I just lost tracks of a series of posts, so I post my question again, hoping someone can help.

Here is codes provided by Jeff Smith
Private Sub Form_Load()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim intI As Integer
Set db = CurrentDb
Set rst = db.OpenRecordse t("qryStudentsS orted")
' Call the routine to clear all fields
' before loading the data.
ClearFields
' Add the StudentName to each text box.
With rst
.MoveFirst
Do Until .EOF Or intI = txtMax
intI = intI + 1
Me("txt" & intI) = !StudentName
.MoveNext
Loop
End With
rst.Close
Set rst = Nothing
Set db = Nothing
End Sub

Can anyone tell me: why need "Call the routine to clear all fields before loading the data"? and

what do these three lines mean?
rst.Close
Set rst = Nothing
Set db = Nothing


Many thanks in advance.

Paul

Nov 13 '05 #3

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

Similar topics

0
2498
by: Andrey Mishenin | last post by:
While accessing MySQl data base by means of perl the value of variable $! sometimes equals " Resource temporarily unavailable". At the mean time everything works correct. What does that mean? _______________________________________________________________ http://chat.bigmir.net/ - ñàìûé óäîáíûé ÷àò ñ ôîòîàëüáîìàìè -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: ...
4
2178
by: David | last post by:
Hi, Buddy, a newbie's question for you guys, In C++, some functions have a return value type "result", what does this mean, I searched on web, but no hint. thanks a lot David
4
2521
by: pete | last post by:
I found it in the view source of a corporate website. <script Language="Javascript"> <!-- var keyMacro= ]; //--> </script>
6
37793
by: **Developer** | last post by:
What does this mean: External component has thrown an exception. My program crashes after it leaves a subroutine. What I see during debugging is when I press F11 at the End Sub statement
7
3321
by: Jake Thompson | last post by:
What does SIMENTRY mean as in ULONG SIMENTRY RemoveFolderItem( hSession, pszFolderID, pszItemID, pAsyncCtl, pRC ) is it necessary?
9
550
by: JoeC | last post by:
m_iWidth = (int)pBitmapInfo->bmiHeader.biWidth; m_iHeight = (int)pBitmapInfo->bmiHeader.biHeight; What does this mean? I have seen v=&var->member.thing; but what does it mean when you change the & for int?
6
2428
by: Bint | last post by:
I'm getting this returned from a PHP script. What does this mean? <b>Parse error</b>: syntax error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM in <b>/ho Thanks B
0
1843
by: steve | last post by:
What does it mean to set a value or April fools all year long :) http://beyondsql.blogspot.com/2008/03/sql-what-does-it-mean-to-set-value.html
1
4157
by: rasmidas | last post by:
Hi, Could anyone please let me know what does it mean by the following statement in solaris shell scripting. $PROMPT " Select an option: " read ans db_option=${ans:=0} I wanted to know the interpretation for this last line. what does it mean by :=0
8
4253
by: Ariel White | last post by:
What does it mean to pass data by value and how does that compare to passing data by reference? Please explain to me why we would pass some data by value and others by reference.
0
8672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9155
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9018
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8858
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7711
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5859
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3038
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.