Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / September 2006

Tip: Looking for answers? Try searching our database.

Can't open more databases

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lina Manjarres - 18 Sep 2006 22:39 GMT
When I am going throu my Access App. I receieve this error message from time
to to time.
I press the End Button and it continues working as if nothing had happend.
What is it?

Thanks a lot, Lina
Barry Gilbert - 18 Sep 2006 22:58 GMT
Are you declaring databases in code and not destroying them? This used to
happen to me a lot until I understood the problem. If you have statements like
Dim mydb As Database  ' or DAO.Database

then you need to explicitly destroy it with
Set mydb = Nothing

Important note: When you create objects like this, you need to have
errorhandling so it will be destroyed even after an error.

On Error GoTo Err_Handler
Dim mydb As Database
'do stuff with your new friend the database

Err_Resume:  
 Set mydb=Nothing
   Exit Sub             ' or Function
Err_Handler:
 Msgbox Err.Description
   Resume Err_Resume

I'm not convinced that this is your problem, but it's very possible.
Barry

> When I am going throu my Access App. I receieve this error message from time
> to to time.
> I press the End Button and it continues working as if nothing had happend.
> What is it?
>
> Thanks a lot, Lina
Lina Manjarres - 18 Sep 2006 23:06 GMT
Hey Barry, thanks a LOT!!!
Yo have been very helpfull!

> Are you declaring databases in code and not destroying them? This used to
> happen to me a lot until I understood the problem. If you have statements like
[quoted text clipped - 26 lines]
> >
> > Thanks a lot, Lina
Lina Manjarres - 18 Sep 2006 23:13 GMT
Barry, one more question.
What if I declare something like this
Private rsSQL As DAO.Recordset
Should I kill it as well?

Thanks a lot, Lina

> Are you declaring databases in code and not destroying them? This used to
> happen to me a lot until I understood the problem. If you have statements like
[quoted text clipped - 26 lines]
> >
> > Thanks a lot, Lina
Barry Gilbert - 18 Sep 2006 23:19 GMT
Yes! Anytime you instantiate an object that requires the New keyword, you
should kill it. One or two un-killed objects won't hurt, but an app that's
left up for a while or one in which you do a lot of these will eat memory and
eventually cause errors. For this reason, it's considered a best pratice to
explicitly destroy all objects when you're finished with them. Kind of like
Godzilla!

Barry

> Barry, one more question.
> What if I declare something like this
[quoted text clipped - 33 lines]
> > >
> > > Thanks a lot, Lina
Lina Manjarres - 18 Sep 2006 23:26 GMT
Thank you very much!

> Yes! Anytime you instantiate an object that requires the New keyword, you
> should kill it. One or two un-killed objects won't hurt, but an app that's
[quoted text clipped - 42 lines]
> > > >
> > > > Thanks a lot, Lina
Lina Manjarres - 28 Sep 2006 21:06 GMT
Hello Barry
I have been doing what you recomended me. It's getting better, the error
message appears less than before. I do not know if I made a mistake, trying
to have a module to kill this opened recordsets.

I made a module like this.  And then I called it form the error message you
show me how to make it. I just pass the recordsets I am using. I do not know,
if this is correct or I may be leaving things unclose and that's  why I am
still getting the same error message, even thou it is less frequent.

Public Sub TreeViewErrorHandler_Click(rst1 As DAO.Recordset, _
   Optional rst2 As DAO.Recordset, _
   Optional rst3 As DAO.Recordset)

 If Not IsMissing(rst1) Then Set rst1 = Nothing
 If Not IsMissing(rst2) Then Set rst2 = Nothing
 Set rsSQL = Nothing
 Set rsSQL1 = Nothing

Set dbs = Nothing

End Sub

> Yes! Anytime you instantiate an object that requires the New keyword, you
> should kill it. One or two un-killed objects won't hurt, but an app that's
[quoted text clipped - 42 lines]
> > > >
> > > > Thanks a lot, Lina
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.