3048 - cannot open any more databases error

smig

Registered User.
Local time
Today, 21:30
Joined
Nov 25, 2009
Messages
2,209
Hi all

I'm using Access 2003 with a medium size aplication, and have this error.
I've searched the web for this error, and know it caused by too many tables, queries, combo boxes and such opened at the same time.

what I'm tryong to do is open a second form with 6 sub forms, and 6 nested sub forms in each. all use very simple tables, and no combo boxes.
this form is used as a week schedule.

the second form is opened by clicking a botton in the main form.
the main form is rather complecated but work OK.

I tried to make the botton to close the main form and open the second one, but still no good.
If I make the botton to only close the main form and then open the second form myself is all good :eek:

any idea ?
any way to totaly unload the main form before opening the schedule one, all in a single click ?
 
Last edited:
I had the same problem with access 2007 when opening a number of forms simultanuously. Searching on google I found a clue on what happens.
It seems indeed true that opening a number of forms with a lot of subforms on them (encouraged by the tab control) do use a lot of JET resources and can lead to error 3048.
I managed to solve it by disconecting al the forms from their subform control and connecting them by code when the user selects it's tab.
Please refer to the site http://www.btabdevelopment.com/main/
there is a sample database showing how to open subforms on a need to see it basis and closing them after it.
I've put that code in a class module (so that every form has it's own environment for closing the opened subforms on changing tabs)
If you need it you can also close the calling form by executing a "DoCmd.Close acForm, me.Name" after the other form's open statement. I would however put both instruction in a routine under a separate module.
 
thanks,

I managed to solve the problem using a totaly different method for the form cause me problems.

but what amazed me is this:
I tried to make the botton to close the main form and open the second one, but still no good.
If I make the botton to only close the main form and then open the second form myself is all good :eek:
 
As I wrote in my previous reply the closing of the first form should not be done in the code module of the form itself but by calling an external routine. for instance you create in a separate module (not in the form's module)

Public sub Leaveform(frm as form)
if frm.dirty then
frm.dirty = false
doevents
endif
docmd.close acform, frm.name
end function

and call it with: Leaveform Me

at the end of the routine that opened the other form.

Obviously this is only a basic code you should add some error handling etc...
 
OK, thanks

as I said I have no problem anymore as I totaly changed the way the secondary form work, but it's god to know for the future.
 

Users who are viewing this thread

Back
Top Bottom