473,549 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can Not Open Any More Databases

Has anyone encountered the error message "Can not open any more databases"
and what did you do to solve it?

Thanks,

Dave
Nov 13 '05 #1
15 2436
The crucial aspect is to identify what is causing the problem.

If you are using Access 97 without the service packs, you are limited to
1024 databases. Applying the service packs doubles this to 2048, so that's
the first step.

Are you using any of the domain aggregate functions such as DLookup(),
DMax(), ... in a query? Each call opens a database, and they don't clean up
after themselves quickly, so you can easily hit the limit as each row of
your query opens a database. Workarounds:
- Leave the domain aggregate function out of the query, and put it on the
form if you only need to display for the current record.
- Use a subquery in place of the domain aggregate function. More info:
http://support.microsoft.com/?id=209066

Each form, subform, report, subreport, combo, and list box also uses up one
for its RecordSource or RowSource. Do you have lots of forms open, each with
lots of subforms? Or do you have heaps of combos? Can you close some forms,
or redesign with fewer combos?

Next, look at your code. Any code that does an OpenRecordset() ? You need to
explicitly Close the recordset at the end of the procedure, and preferable
set the recordset variable to Nothing as well. Access is actully good at
cleaning up after itself, but not perfect. You can also see if you have lots
of forms where you refer to the RecordsetClone as well. It uses only 1
database variable for each form where you use the RecordsetClone, but these
are not released until the form is closed.

Hope that's enough to help you identify the cause of the message.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Dave" <no***@email.co m> wrote in message
news:Ng******** *********@newsr ead3.news.atl.e arthlink.net...
Has anyone encountered the error message "Can not open any more databases"
and what did you do to solve it?

Thanks,

Dave

Nov 13 '05 #2
Allen Browne wrote:
If you are using Access 97 without the service packs, you are limited to
1024 databases. Applying the service packs doubles this to 2048, so that's
the first step.


Allen what do you mean by this? You can only have 1024/2048 mdbs
developed for one installation? Does it "wear out" or something? Is
there an internal mdb counter that runs out? I don't mean to sound
facetious, I just don't know what you mean...
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
Nov 13 '05 #3

Tim Marshall wrote:
You can only have 1024/2048 mdbs developed for one installation?
Does it "wear out" or something? Is there an internal mdb counter
that runs out?


No, you can only have 1024/2048 databases open at one time. The catch
is that Access interprets "open" differently than you or I. Each time
you set a database variable, that counts as another open database; etc.

Even so, I've never even come close to the limit.

--
Martha Palotay
don't google to email

Nov 13 '05 #4
No. You can have lots of database on your drive.

When you run an instance of msaccess, any one workspace within that instance
can only have 2048 databases open at once.

You can see how many you have open at present by opening the Immediate
window (Ctrl+G) and entering:
? dbEngine(0).Dat abases.Count

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Tim Marshall" <TI****@PurpleP andaChasers.Moe rtherium> wrote in message
news:cv******** **@coranto.ucs. mun.ca...
Allen Browne wrote:
If you are using Access 97 without the service packs, you are limited to
1024 databases. Applying the service packs doubles this to 2048, so
that's the first step.


Allen what do you mean by this? You can only have 1024/2048 mdbs
developed for one installation? Does it "wear out" or something? Is
there an internal mdb counter that runs out? I don't mean to sound
facetious, I just don't know what you mean...

Nov 13 '05 #5
> Has anyone encountered the error message "Can not open any more databases"
and what did you do to solve it?


I ran into that error yesterday. I was looping through the TableDefs
collection and doing a db.Execute to put all the table names in a table. I
was calling another function with a "db.OpenRecords et" and forgot the
MoveNext. So even though I had a db = Nothing in the original sub, the loop
still opened enough databases to barf up the error.

What's interesting in Allen Browne's comments is that DLookup, DMax,
RecordSources and RowSources also use a database objects. So How are we
supposed to clean up these? cboList = Nothing?
Nov 13 '05 #6
> The crucial aspect is to identify what is causing the problem.

What about best practices for using Database and other objects? Let's say I
need to open multiple Recordsets or have multiple db.Execute statements in
the same function - or have a function that calls other functions - that
calls other functions - and each function creates similar objects. For
example, the first function has Set db = DAO.Database (and Set db.QueryDefs
= db.QueryDefs, etc.), and calls another function that does the same thing.
I understand that variables are scoped to the function in which they are
created, but what about these DAO objects? Is it okay to one function 'Set
db = DAO.Database' and then call another function that does another 'Set db
= DAO.Database', and so on?

Should each object be named differently:

Dim dbA As DAO.Database
Dim dbB As DAO.Database
Dim rstA As DAO.Recordset
Dim rstB As DAO.Recordset

When is it necessary to do this? Can I simply 'Set rst = something else'?
Or do I need to 'Set rst = Nothing' first?
Nov 13 '05 #7
Best practice is to declare the object in the procedure that needs it,
rather than declaring a public object and having everything use it. Too much
scope for interference there.

There is no need to use different names in different procedures. They are
already different objects.

If you are in the middle of one routine, and you have a child procedure that
also needs to operate on the Database or Recordset, you can pass the object
to the child proc. Example:
Function MyMain()
Dim db As DAO.Database
'do something with the database
Call MyChild(db)
End Function
Function MyChild(db As DAO.Database)
'do something else with the same Database object.
End Function
That approach can help avoid extra database variables, but it can also do
things like letting you see the RecordsAffected in the main proc after the
child proc runs.

Unless you write spagghetti code, every procedure has just one entry point,
and just one exit point. Even after an error, it exits from the same point,
and in that point you include any clean up code such as setting your objects
to Nothing. That's all you need to do.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"deko" <de**@hotmail.c om> wrote in message
news:Ag******** *********@newss vr13.news.prodi gy.com...
The crucial aspect is to identify what is causing the problem.


What about best practices for using Database and other objects? Let's say
I
need to open multiple Recordsets or have multiple db.Execute statements in
the same function - or have a function that calls other functions - that
calls other functions - and each function creates similar objects. For
example, the first function has Set db = DAO.Database (and Set
db.QueryDefs
= db.QueryDefs, etc.), and calls another function that does the same
thing.
I understand that variables are scoped to the function in which they are
created, but what about these DAO objects? Is it okay to one function
'Set
db = DAO.Database' and then call another function that does another 'Set
db
= DAO.Database', and so on?

Should each object be named differently:

Dim dbA As DAO.Database
Dim dbB As DAO.Database
Dim rstA As DAO.Recordset
Dim rstB As DAO.Recordset

When is it necessary to do this? Can I simply 'Set rst = something else'?
Or do I need to 'Set rst = Nothing' first?

Nov 13 '05 #8
There is no need to use different names in different procedures. They are
already different objects.
I see. So I assume I can also reSet the object in the same function as
needed:

Set rst = this
Set rst = that
Set rst = otherthing
and only when I'm done:
Set rst = Nohting
Unless you write spagghetti code, every procedure has just one entry point, and just one exit point.


10-4
Nov 13 '05 #9
Yes, you can reuse an object like that.

Personally I would set to Nothing before reusing it, but that may just being
pedantic.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"deko" <de**@hotmail.c om> wrote in message
news:kI******** *********@newss vr21.news.prodi gy.com...
There is no need to use different names in different procedures. They are
already different objects.


I see. So I assume I can also reSet the object in the same function as
needed:

Set rst = this
Set rst = that
Set rst = otherthing
and only when I'm done:
Set rst = Nohting
Unless you write spagghetti code, every procedure has just one entry

point,
and just one exit point.


10-4

Nov 13 '05 #10

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

Similar topics

1
1901
by: Navin Kulshreshtha | last post by:
Hello, I just installed SQL Server 2000 on my home computer and am connecting to a remote SQL server over the Internet. I can log into the server just fine and see 7 folders including the 'Databases' folder. I can open up all of the other 6 folders but for some crazy reason when I double click on the 'Databases' folder, I can't open it! The...
6
11660
by: Debbie Gilbert | last post by:
When running a report..I get the message "Cannot open any more databases." Run-time error 3048... Has anyone seen this message before?
46
5951
by: Steve | last post by:
Access97 Database The database is split into a frontend and backend and not connected to any other database. The database has an unbound report with 15 subreports. Some of the subreports include Excel charts in unbound object frames. When I add 3 additional subreports, I get the error message that Access can't open any more databases. Can...
1
2237
by: Niranjan | last post by:
I have a relatively straight forward report. The query that populates data for this report is complicated. The report opens without any problem and I can print it as well. However, If I have another form open (has about 12 combo boxes) and then I run the report, it appears on the screen, no problem. When I print the report, I get 'Cant open...
1
1776
by: Phil Stanton | last post by:
Real problem usink AK2 I have got a form with 7 tabs on it, numerous subforms and combo boxes. as well as continuous subforms with combo boxes. I get the message "Can't open any more databases" as I move to a tab with yet another subform on it. Firstly I suspect it means it can't open any more queries or recordsets. Can anyone confirm...
1
279
by: Database Newbie | last post by:
I am trying to do my first database app in VB. I am using the following code from Mastering Visual Basic 6. When I start the project, the common dialog to open the database comes up and I select the Northwind database. If I insert a test line of code, the app will print the name and location of the database in one of the text areas. ...
15
8260
by: Rob Nicholson | last post by:
I'm starting to worry a bit now. We're getting the above error when two users hit the same database/page on an ASP.NET application using ADO.NET, talking to a SQL 7 server. The error is perfectly repeatable :-( But this should help! The error is occurring inside ExecuteReader which uses a DataReader internally. Here are some things that...
11
2121
by: -Lost | last post by:
IP2Location has limited databases: 0.0.0.0 to 99.255.255.255, which if I read correctly excludes: 100.255.255.255 through 255.255.255.255 MindMax is awesome! However, it only offers Country and City lookups. The problem with both of these however is a proprietary binary format (DAT), which excludes anyone from making specific changes,...
2
7160
n8kindt
by: n8kindt | last post by:
i'm stuck. i'm using access 2007 on a windows vista machine (i've tried running on xp too, though--same result) and this is the error i keep getting whenever i try running my main query: Cannot open any more databases. (Error 3048) You have reached the limit on the number of databases that can be opened at one time. Close one or more...
0
7459
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7726
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. ...
0
7967
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...
1
7485
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5097
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...
0
3505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3488
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1953
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
1
1064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.