Hi Connie
It is very important to close all Recordsets, as unclosed Recordsets are one
of the things that cause Access to mail to close, as well as excessive
memory use.
You will get an error if you try to close a Recordset that is already
closed, or has never been opened, and unfortunately there is no easy way to
check if a DAO Recordset has been closed or not. You can check for Nothing,
so it's good practice to Set rst=Nothing immediately after rst.Close. Then,
in your exit block, you can say:
If Not rst is Nothing Then
rst.Close
Set rst = Nothing
End If
However, just to be certain nothing fails in the exit block, I always start
it with On Error Resume Next.
Best wishes,
Graham
> From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of mrsgoudge
> Sent: Wednesday, 26 October 2011 06:50
> To: MS_Access_Professionals@yahoogroups.com
> Subject: [MS_AccessPros] Closing rst's and setting = Nothing etc.
>
>
> In an event several recordsets are created. Some of them are not used in
certain instances where the sub exits because of conditions. In the Exit
Procedure Can I close and set = Nothing all the recordsets that were created
at the beginning even though they were not set to anything?
>
> Thanks!
> Connie
Selasa, 25 Oktober 2011
RE: [MS_AccessPros] Closing rst's and setting = Nothing etc.
__._,_.___
MARKETPLACE
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar