M
Mota
Hi;
Each variable has its own scope and life,and when the containing Sub or
Function or Module ends,the variable distroies and no effect of its content
remains.But it seems its not true for Recordset variables and they remains
open for a long time.I have 3 questions on this topic:
1-If we not to close a Rs,up to when it occupies memory and what time it
frees it?When the containing module or form closes,when i close my
application,or when windows shuts down?(Unlike VB,there is no command
"Unload Me" available for closing Access forms.)
2-To saving System Resources,which one is preffered: Rs.Close or Set
Rs=Nothing ?Which one frees the System Resources?
3-When we reuse a Rs variable,do we have to first close first one,and then
set it to another object?For example,is this code sufficient:
Set Rs=something
My Code Here....
Set Rs=Something Else
Another code here
Rs.Close
Or its better to use this:
Set Rs=something
My Code Here....
RS.CLOSE
Set Rs=Something Else
Another code here
Rs.Close
I will be so much grateful to anyone can help me.and thank you in advance.
Each variable has its own scope and life,and when the containing Sub or
Function or Module ends,the variable distroies and no effect of its content
remains.But it seems its not true for Recordset variables and they remains
open for a long time.I have 3 questions on this topic:
1-If we not to close a Rs,up to when it occupies memory and what time it
frees it?When the containing module or form closes,when i close my
application,or when windows shuts down?(Unlike VB,there is no command
"Unload Me" available for closing Access forms.)
2-To saving System Resources,which one is preffered: Rs.Close or Set
Rs=Nothing ?Which one frees the System Resources?
3-When we reuse a Rs variable,do we have to first close first one,and then
set it to another object?For example,is this code sufficient:
Set Rs=something
My Code Here....
Set Rs=Something Else
Another code here
Rs.Close
Or its better to use this:
Set Rs=something
My Code Here....
RS.CLOSE
Set Rs=Something Else
Another code here
Rs.Close
I will be so much grateful to anyone can help me.and thank you in advance.